Page 1 of 2

Character encoding in Comments

Posted: Sun May 07, 2017 3:43 am
by Valhal
I have thousands of JPG files with comments in the file:comment field that use special Danish characters. I have XnViewMP installed on both a Windows 7 and a Macintosh machine. When I display the comments as info with the images in fullscreen the characters are shown correctly on the Windows machine, but on the Macintosh the special characters are garbled.

Both computers are set up with English as the default language, so I don't understand why XnViewMP behaves differently. I believe there ought to be a choice of encoding for the file:comment field like there is for the iptc:caption field, so that you can correctly display any comment field encodings independent from your computer setup. Is there any way for me to fix the problem with the current version of XnViewMP?

Re: Character encoding in Comments

Posted: Tue May 16, 2017 2:12 pm
by xnview
could you send me a jpg file, please?

Re: Character encoding in Comments

Posted: Wed May 17, 2017 3:28 pm
by Valhal
Hi Pierre,

I attach a JPG image with Danish characters in the file:Comment field.

Valhal

Re: Character encoding in Comments

Posted: Wed May 24, 2017 3:09 pm
by Valhal
Can anybody help? I tried setting the locale on the Mac to en_us.iso8859-1 (was en_us.utf8), but it made no difference. It would be nice if XnViewMP could display the comments correctly regardless of the computer setup.
Thank you.
Valhal

Re: Character encoding in Comments

Posted: Wed Jun 07, 2017 10:58 am
by xnview
Valhal wrote:Can anybody help? I tried setting the locale on the Mac to en_us.iso8859-1 (was en_us.utf8), but it made no difference. It would be nice if XnViewMP could display the comments correctly regardless of the computer setup.
Thank you.
Valhal
you have not that?
Screen-2017-06-07_12-56-55.png
PS: There is no info in file:comment about encoding

Re: Character encoding in Comments

Posted: Fri Jun 09, 2017 11:05 pm
by Valhal
Hi Pierre,

I don't understand your question. The picture only shows a small part of the file:comment. I attach one that shows the whole comment using Faststone in Windows 7. If there is no indication of the character encoding for file:comment then XnViewMP should determine the encoding from the text, if possible, like it is done by Notepad++. If it cannot determine the encoding I would suggest that the default guess should be ANSI. ISO 8859-1 is used a lot in Europe and should be easy to determine.

Thanks,

Carl
20160902-0936-P1150114-comment.jpg

Re: Character encoding in Comments

Posted: Fri Jun 09, 2017 11:13 pm
by Valhal
Clarification:

On Windows XnViewMP displays the comment like Faststone does. On the Mac, however, the comment is shown like it is on Windows in Exiftool GUI with the special characters garbled:
20160902-0936-P1150114-comment-exiftool.jpg

Re: Character encoding in Comments

Posted: Sat Jun 10, 2017 12:21 pm
by xnview
Valhal wrote: On Windows XnViewMP displays the comment like Faststone does. On the Mac, however, the comment is shown like it is on Windows in Exiftool GUI with the special characters garbled:
Strange please check my screenshot, the comment is not like that...

Re: Character encoding in Comments

Posted: Sat Jun 10, 2017 4:49 pm
by Valhal
Hi Pierre,

I don't know if your screenshot is made on a Mac and which program you are using. The fact that XnViewMP displays the comment differently on different computers indicates that there is a problem. XnViewMP should display the comment correctly independent of the type of computer and the computer setup.

I tried the XnViewMP SetComment function on Windows, and more problems arise. The Setcomment window looks like this:
20160902-0936-P1150114-xnviewmp-setcomment.jpg
20160902-0936-P1150114-xnviewmp-setcomment.jpg (50.81 KiB) Viewed 973 times
When I replace the second garbled character with the Danish character æ, and write the file, I get the following comment displayed by XnViewMP as well as by Faststone:

Vi tager afsked med Thomas. Han er t�mrer/snedker og arbejder stadig i sit værksted. Hans sidste v�rk er denne paddel lavet af det eftertragtede hawaiianske koa tr�.

The first garbled character was an ø and the next three were æ. You now see that the first æ is correctly encoded in UTF-8 whereas the ø and the last two æ's have been encoded as the garbled character.

XnViewMP cannot assume that the comment is encoded in UTF-8. There needs to be a setting in XnViewMP so that the user can tell the program what the encoding of the comment field is. That would be better and easier to implement than my previous suggestion that XnViewMP try to determine the encoding from the text, which can be impossible for short comments.

Thank you.

Carl

Re: Character encoding in Comments

Posted: Sat Jun 10, 2017 6:27 pm
by xnview
Valhal wrote: I don't know if your screenshot is made on a Mac
yes on mac, and no problem
XnViewMP cannot assume that the comment is encoded in UTF-8. There needs to be a setting in XnViewMP so that the user can tell the program what the encoding of the comment field is. That would be better and easier to implement than my previous suggestion that XnViewMP try to determine the encoding from the text, which can be impossible for short comments.
i'll add a settings for comment encoding

Re: Character encoding in Comments

Posted: Sat Jun 10, 2017 7:45 pm
by XnTriq
Dunno if that's relevant: On Windows, all Dano-Norwegian letters are displayed correctly in MP's IPTC-IIM tab and Edit IPTC/XMP dialog after copying the JPEG comment to IPTC caption with XnView Classic's cmd_CopyCommentIntoCaption command.

Re: Character encoding in Comments

Posted: Sun Jun 11, 2017 7:15 pm
by Valhal
Pierre wrote:
i'll add a settings for comment encoding
Thank you. That would be the best solution.

Xntriq: Copying all the comments to the IPTC field can also be done with exiftool, but it would be a lot of work for the 30,000 files that I have. And besides, it would be better to improve XnViewMP so that it can correctly display the comment for different encodings of the comment field.

Valhal

Re: Character encoding in Comments

Posted: Sun Jun 11, 2017 8:15 pm
by XnTriq
Valhal wrote:Xntriq: Copying all the comments to the IPTC field can also be done with exiftool, but it would be a lot of work for the 30,000 files that I have. And besides, it would be better to improve XnViewMP so that it can correctly display the comment for different encodings of the comment field.
Yes, I absolutely agree, Valhal (-:

Re: Character encoding in Comments

Posted: Sat Jun 17, 2017 5:02 pm
by xnview
Issue 1235 is fixed in next version.

Re: Character encoding in Comments

Posted: Sat Jul 08, 2017 12:54 pm
by xnview
This problem is supposed to be fixed in XnView MP 0.87. Please check and confirm the bug fix here.