Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, June 25, 2013 1:10:17 AM(UTC)
leonlihkust

Groups: Registered
Posts: 12


I am using Leadtools for developing a MFC tools to write some IPTC info. But seems it cannot handle unicode info. Could you help me on this problem?

CString str;
m_Lead1.SetComment(CMNT_IPTC_CAPTION, COleVariant(str)); m_Lead1.WriteComment(szSrcImageFile, 0);

Is there any thing to set for unicode display?
I noticed there is one property named ‘coded character set’.

Thanks
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, June 25, 2013 5:41:16 AM(UTC)

Daoud  
Daoud

Groups: Registered
Posts: 256


Leon,
Please answer the following questions?
1) Are you using our LEAD Main OCX control or a different object?
2) Which version of LEADTOOLS are you using (14.5, 16, 17, etc.)?
3) Which version of Visual Studio do you use?
4) Please attach a sample image you're trying to write the comment to, in addition to the Unicode string you're attempting to save.

 
#3 Posted : Tuesday, June 25, 2013 6:49:11 AM(UTC)
leonlihkust

Groups: Registered
Posts: 12


Thanks for your reply.
1. Lead Main Ocx control.
2. 16
3. VS 2010
4. I am trying to write comment to a windows photo. please refer to the photo in the attachment. Here is the string I try to write to the photo, some Chinese words:
呜呜邨邨


File Attachment(s):
Chrysanthemum.jpg (859kb) downloaded 29 time(s).
 
#4 Posted : Tuesday, June 25, 2013 6:50:21 AM(UTC)
leonlihkust

Groups: Registered
Posts: 12


sorry I do not know how to add an attachment.
 
#5 Posted : Tuesday, June 25, 2013 4:04:07 PM(UTC)
leonlihkust

Groups: Registered
Posts: 12


Sorry but it should be Leadtools 17.

I find a same case with mine on the forum.
http://support.leadtools.com/CS/forums/39903/ShowPost.aspx

I would like to know:

1. Do I need to format the string to Unicode for IPTC info,even if the project is Unicode and the string is unicode? Like the above case function Encoding.UTF8.GetBytes( ) is used.

2. What does the following sentence mean? Dose it mean it is useless to write a Unicode tag to photo IPTC info, as few viewer programs will recognize this tag ? How can Windows recognize whether IPTC info is Unicode or not?

With leadtools you can however build a viewer which can recognize tags written in UTF8, but common viewers will not recognize these tags.

Thanks a lot in advance.
 
#6 Posted : Wednesday, June 26, 2013 8:47:32 AM(UTC)

Daoud  
Daoud

Groups: Registered
Posts: 256


Leon,
You can either insert the comment as ASCII using our toolkit, or you can use UTF8 encoding to convert Unicode strings to ASCII-like strings, then insert the comment.

Since the resulting strings will always contain ASCII characters, it doesn't make a difference to the inserting function. The difference is important for the viewer program you will be using.

If the program only reads direct ASCII and doesn't do UTF8 decoding, it will not correctly read comments that contain Unicode strings that were converted.

Do you have a sample image that contains Unicode strings in their comments, and you can view these comments correctly with the target viewer you will be using?
If yes, send me a sample image that contains these Unicode comments and I will try to create similar comments using our control for you.
If you want to attach files to our forums, put them in a ZIP or RAR file and do not use the "Preview" feature.

 
#7 Posted : Wednesday, June 26, 2013 5:25:56 PM(UTC)
leonlihkust

Groups: Registered
Posts: 12


Thanks for your reply.
I have some questions in the below:

1. What does 'ASCII-like strings' means? Does it mean the string is Unicode but can be recognized by ANSI program, or in the contrary, the string is ANSI but recognized by Unicode program?

2. You mentioned that the insert function does not matter but the viewer program. So what you mean here is that if I have a viewer program applied UTF8 decoding, then I can read any string ANSI or Unicode I inserted from photo, and it has nothing to do with the insert function. Am I right?

3. I attached a ZIP file contains two photo file:
Photo_WindowsInput.jpg (I input string '呜呜呜邨邨邨'' to Tittle by windows photo properties)
Photo_leadtoolsInput (Input string by leadtools function writecomment)
You can see both result and file size is different.

Can you help me input the string '呜呜呜邨邨邨' to the photo using your function ?

Thanks a lot for your help.
File Attachment(s):
Photo sample.rar (1,717kb) downloaded 29 time(s).
 
#8 Posted : Sunday, June 30, 2013 8:03:41 AM(UTC)

Daoud  
Daoud

Groups: Registered
Posts: 256


Leon,
The string consists of ANSI characters, but they are not directly understood by ANSI-only programs. For example, a Chinese character is encoded in Unicode using 16 bits. When the same character is encoded in UTF8, it might be 4 bytes, each of them part of the ASCII character set, but they are only understood to be the original Chinese character by a program that supports UTF8.
A simple ASCII reader would think they are simply 4 ANSI characters.

I didn't write that the insert function doesn't matter. I wrote it doesn't "care" about the string. It will always write it correctly because the string only contains ASCII characters when encoded as UTF8.
However, if you try to give it a Unicode string directly, it will probably not be able to write it correctly because it will contain characters outside the ASCII range.

Did you try the approach in the following forum thread?
http://support.leadtools.com/CS/forums/39903/ShowPost.aspx

Do you have a viewer that can display UTF-8 comments? Or do you plan to use it with LEADTOOLS?

 
#9 Posted : Monday, July 1, 2013 6:51:31 PM(UTC)
leonlihkust

Groups: Registered
Posts: 12


Thanks again for your kindly explanation.

I got you idea in two directions:

1. For writing comment to photo, the function does not matter but the string encoding format matters. Whether it is encoded in ANSI or UTF8 is the key difference. For some Chinese characters encoded with UTF8, it would not display correctly if it is written to photo with ANSI encoding. And IPTC does not accept Unicode formatting.

2. For reading comment part, the viewer can shows the characters encoded with UTF8 if it supports UTF8 decoding.

Is my understanding correct?

I tried to write the Chinese character encoded with UTF8 and it do display in a UTF8 supported viewer(IrfanView).

I have another issue which is how to make UTF8 string display in Windows(Properties -> details). It seems that Windows has its own way to recognize UTF8 string. Does the tag be known by Windows?

http://leadtools.com/help/leadtools/v175/dh/L/Leadtools~Leadtools.RasterCommentMetadataDataType.html

I attached a photo with UTF8 string, you can see it does not display properly in Windows (Properties -> details). Any suggestion for it?
File Attachment(s):
Photo_UTF8string.rar (860kb) downloaded 29 time(s).
 
#10 Posted : Tuesday, July 2, 2013 7:21:29 AM(UTC)

Daoud  
Daoud

Groups: Registered
Posts: 256


I think both points 1 and 2 are correct.


About the new issue, I will try to answer here but if you need to follow up please  open a new forum thread or support email ticket for it.

If a common viewer correctly shows the Chinese comments in an image, you can consider this image to be correct.
If the same image comments are not shown correctly by a different viewer, there is nothing our toolkit can do, because we cannot control how other viewers decode the text.
 
#11 Posted : Tuesday, July 2, 2013 5:01:38 PM(UTC)
leonlihkust

Groups: Registered
Posts: 12


Thanks a lot for your help. You really solved my question.

I will open a new forum thread for the new issue.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.333 seconds.