Unicode Exif User Comment(s) are printed as random Chinese characters (maybe a bad Unicode/UTF8 conversion ?) while ExifTool 12.51 prints the same information correctly.
Effect: The user can't see Exif user comment in explorer window.
To reproduce:
1. Add in Tools/Parameters/Explorer/Vignette the item "EXIF: User Comment"
2. Browse any PNG or JPG file with an Unicode Exif User Comment (as an example, download any image from https://image.civitai.com)
Actual behaviour (bug): Exif User Comment is displayed as random Chinese characters
Expected behaviour: The user comment is normaly displayed (as in the ExifTool 12.51).
I send you just 3 different files (the others are too big to be attached):
1. The first is a PNG image "00000-1192013237.png" with a Unicode tag "User Comment" and a ASCII/ANSI tag "Parameters" correctly shown both in ExifTool panel, just "User Comment" shown in Properties panel, and wrongly displayed in EXIF panel and vignette item "EXIF: User Comment" which apparently use both the EXIF module. In this case the "User Comment" is an "eXIf" chunk (in UNICODE format) and "Parameters" is an "tExt" chunk (in ASCII/ANSI format).
2. The second is a JPG image "geraldW3_prew1.jpg" with a Unicode tag "User Comment" correctly shown in ExifTool panel, not shown in Properties panel, and wrongly displayed in EXIF panel and vignette item "EXIF: User Comment" which apparently used both EXIF module.
3. The third is an PNG image "00088-3421647346.png" with a Unicode tag "Parameters" correctly shown in Properties panel (Extra->parameters") but there is no EXIF panel, correctly displayed by ExifTool panel (PNG->Parameters) and nothing to display as custom text of vignette. "Parameters" tag uses an "iTXt" chunk.
As I said, the error maybe come from EXIF module after a missing Unicode->UTF8 conversion...
These 3 files are typical files produced by almost all AI software nowadays and all these files have this kind of tags.
In all cases, ExifTool always gives the right answer!
Thank you for your time and your smart tool,
Chris
P.S. Additionally, you will see another small display bug for the third file in Properties panel, between "anatomy)" and "easynegative" as Extra->parameters Unicode tag uses some SC (simplified Chinese) characters and the default font used by Properties/ExifTools/EXIF panels do no have these characters: there is any way to change the default font used by these panels ? This is *only* a graphical bug, because when you copy the entry to Notepad++ or any browser you can see correctly all text.
P.S.2. Why "Extra->parameters" line in "Properties" panel is "auto-multi-line" (which is the smart way to print for the user) and the same information displayed in the "ExifTool" panel "PNG->Parameters" doesn't? Maybe a different way to deal with CR('\n') character...
Attachments
PNG file with Unicode tag "Parameters"
00088-3421647346.png (425.51 KiB) Viewed 10075 times
PNG file with Unicode tag "User Comment" and ASCII/ANSI tag "Parameters"
00000-1192013237.png (365.19 KiB) Viewed 10075 times
TesteurXnView wrote: Sat Jul 22, 2023 12:35 pm
As I said, the error maybe come from EXIF module after a missing Unicode->UTF8 conversion...
These 3 files are typical files produced by almost all AI software nowadays and all these files have this kind of tags.
In all cases, ExifTool always gives the right answer!
The User Comment is not correct, EXIF is little endian and UserComment is big endian. I'll check how to detect if it's BE or LE order...
Hi Pierre,
YES, you're right: "geraltW3_prew1.jpg" is an "hybrid" file as it has a JFIF segment FFE0 and an EXIF segment FFE1. And in EXIF segment the "User comment" is in BE format. The same format as in PNG file "00000-1192013237.png".
I send you my screenshots for these 3 images.
As I said, and as you can see in these screenshots, ExifTools always gives the right answer for all tags ("User comment" and "parameters"). And I tested ExifTool separately in Windows console: same behavior as in XnView panel. The default output is in UTF8 format, independently of the original format ANSI/UTF8/Unicode BE/LE inside the image. Additionally, this matches with the native format of QString...
The only problem is just the EXIF module. And here, as I suppose this module is internal to XnView, I don't have the source code to help you. A "quick and dirty" way is to test if the majority of WCHARs in "User Comment" have a null LSB, in this case you switch between LSB/MSB... Or maybe, you can consider to enable ExifTool outputs for vignette items instead of EXIF module ? In Properties Panel you use ExifTool output too.
TesteurXnView wrote: Mon Jul 24, 2023 1:28 pm
The only problem is just the EXIF module. And here, as I suppose this module is internal to XnView, I don't have the source code to help you. A "quick and dirty" way is to test if the majority of WCHARs in "User Comment" have a null LSB, in this case you switch between LSB/MSB...
yes i'll try like that, but null LSB doesn't work for asian chars for example....
OK, then something more sophisticated:
This function computes the sum of absolute distance for successive Unicode characters (from input buffer) in both ways then compares results:
I checked on version 1.5.5: the Unicode Exif user comment is now correctly printed in EXIF panel (as it was in ExifTool panel)
BUT
the same user comment is always bad printed as vignette description if someone select user comment (the 2 Unicode bytes are wrongly swapped as in all previous versions of XnViewMP). You can use the same files I send to you in July ("00000-1192013237.png" and "geraltW3_prew1.jpg").
Hi Pierre,
I confirm that Unicode Exif user comments are now correctly displayed also as vignette/thumbnail labels in XnView MP version 1.6.0.
I discovered some other small bugs in Parameters/vignette/labels dialog box (non-releated to the current bug) so I will create another report.