Skip to content

UserComment #116

@FSofTlpz

Description

@FSofTlpz

I have a problem with 'UserComment'. Unfortunately we can have the exif byte order 'big endian' or 'little endian'. The UserComment must read/write with the correct byte order (for Unicode).
2 little changes worked for me:
in ExifPropertyFactory.cs, line 72:

                   else if (string.Compare(encstr, "Unicode\0", StringComparison.OrdinalIgnoreCase) == 0)
                       enc = byteOrder == BitConverterEx.ByteOrder.LittleEndian ? 
                                                   Encoding.Unicode : 
                                                   Encoding.BigEndianUnicode;

in ExifExtendedProperty.cs, line 106:

                 else if (mEncoding.EncodingName == "Unicode" ||
                            mEncoding.EncodingName == "Unicode (Big-Endian)")
                    enc = "Unicode\0";

In my code i set explicit the value with Encoding:

           if (data is ExifLibrary.JPEGFile &&
               (data as ExifLibrary.JPEGFile).ByteOrder == BitConverterEx.ByteOrder.BigEndian) {
              data.Properties.Set(ExifTag.UserComment, txt, System.Text.Encoding.BigEndianUnicode);
           } else
              data.Properties.Set(ExifTag.UserComment, txt, System.Text.Encoding.Unicode);

With best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions