MetaIO icon indicating copy to clipboard operation
MetaIO copied to clipboard

Dictionary writes UNICODE but does not read correctly.

Open blowekamp opened this issue 1 year ago • 0 comments

This issue is first reported here: SimpleITK/SimpleITK#2082

It appears that MetaIO does not sanitize the input to write from UNICODE, and can write some UNICODE strings. However, MetaIO is not able to read the same UNICODE string it has written.

Example output from above:

Expected equality of these values:
  img2.GetMetaData("test2")
    Which is: "des caract\xC3\xA8res sp\xC3\xA9" "ci"
    As Text: "des caractères spéci"
  value2
    Which is: "des caract\xC3\xA8res sp\xC3\xA9" "ci\xC3\xB6"
    As Text: "des caractères spéciö"

The Sample header file:

ObjectType = Image
NDims = 3
BinaryData = True
BinaryDataByteOrderMSB = False
CompressedData = False
TransformMatrix = 1 0 0 0 1 0 0 0 1
Offset = 0 0 0
CenterOfRotation = 0 0 0
AnatomicalOrientation = RAI
ElementSpacing = 1 1 1
test1 = des caractères spéciaux
test2 = des caractères spéciö
DimSize = 2 2 2
ElementType = MET_DOUBLE
ElementDataFile = LOCAL

blowekamp avatar Mar 26 '24 16:03 blowekamp