Character encoding in Comments

Reported bugs that have been closed and/or resolved

Moderators: XnTriq, helmut, xnview, Dreamer

Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Character encoding in Comments

Post 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?
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post by xnview »

could you send me a jpg file, please?
Pierre.
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post by Valhal »

Hi Pierre,

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

Valhal
Attachments
20160902-0936-P1150114.jpg
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post 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
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post 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
Pierre.
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post 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
Last edited by Valhal on Fri Jun 09, 2017 11:16 pm, edited 1 time in total.
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post 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
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post 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...
Pierre.
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post 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 2186 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
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post 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
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Character encoding in Comments

Post 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.
Valhal
Posts: 7
Joined: Sun May 07, 2017 3:28 am

Re: Character encoding in Comments

Post 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
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Character encoding in Comments

Post 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 (-:
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post by xnview »

Issue 1235 is fixed in next version.
Pierre.
User avatar
xnview
Author of XnView
Posts: 43326
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Character encoding in Comments

Post by xnview »

This problem is supposed to be fixed in XnView MP 0.87. Please check and confirm the bug fix here.
Pierre.
Post Reply