dcmjs
dcmjs copied to clipboard
Text encoding, how to do it?
Hi, thanks for the library. I am having problems with string encodings, see this example:
var dcmjs = require("dcmjs");
const { DicomDict, DicomMessage} = dcmjs.data;
var ds = new DicomDict({})
ds.upsertTag("0008103E", "LO", "ä")
buf = ds.write()
ds2 = DicomMessage.readFile(buf)
ds2.dict["0008103E"].Value[0] == 'ä'
What is the right way to write DICOM files with proper encoding? Reading DICOM files containing special characters which were created with pydicom (without explicitly specifying the character set) works well in my case.
I think the problem is here, strings are read byte by byte, which is not compatible with utf8: https://github.com/dcmjs-org/dcmjs/blob/168a95401f1eac262a8488dd0d9be4a5482a83f0/src/BufferStream.js#L214-L225
fixed for my use-case with #92