LEADTOOLS Support
Document
Document SDK Questions
Problems Loading Annotation XML with Unicode Characters
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, February 22, 2008 11:07:43 AM(UTC)
Groups: Registered
Posts: 2
Hello, I am using .NET LeadTools v15 and am having issues trying to load a saved annotation XML that has unicode characters in the annotations text. The problem is that after the annotation is loaded, the text has incorrect characters in it.
<br /><br />
The code I am using is quite simple:
<br /><br />
AnnContainer anns = new AnnContainer();<br />
AnnCodecs annCodecs = new AnnCodecs();
<br /><br />
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(annStr));
<br /><br />
annCodecs.Load(stream, anns, 1);
<br /><br />
I have saved the annotation xml string in a file which is attached to this message. <br /><br />
I can use the annCodecs.Load method to load the annotation file, and then the characters come out properly. But my application is not going to be reading files, it is going to be passed strings, and loading the string that is in the file is not working properly.
<br /><br />
As you can see, the resulting annotations text should be "錢莊吸血 月息15分榨乾唐雅君" but is actually coming out as "錢莊å¸è¡€ 月æ¯15分榨乾å”é›…å›".
<br /><br />
Any idea what could be wrong here?
<br /><br />
Thanks
#2
Posted
:
Friday, February 22, 2008 1:34:23 PM(UTC)
Groups: Registered
Posts: 2
I also want to note hear, you will need to have the Easy Asian Languages support installed to be able to see the Chineese characters in my annotation file.
#3
Posted
:
Sunday, February 24, 2008 5:51:43 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I have tested the issue here
and I was able to load your text correctly from stream.
Here is the code I used to load
the ANN file:
FileStream FSstream = new
FileStream(annFileName, System.IO.FileMode.Open);
Byte[] buffer = new
Byte[FSstream.Length];
FSstream.Read(buffer, 0,
(int)FSstream.Length);
FSstream.Close();
MemoryStream MSstream = new
MemoryStream(buffer);
MSstream.Seek(0,
SeekOrigin.Begin);
AnnCodecs.Load(MSstream,
container, 1);
You will find attached also a
ZIP file that contains both the JPEG image and the ANN file I worked with and a
screenshot of how the test was displayed at my end.
Can you please tell me the LEADTOOLS
DLLs build number(Version info) that you are working with?
File Attachment(s):
Ann.zip (70kb) downloaded 26 time(s).
LEADTOOLS Support
Document
Document SDK Questions
Problems Loading Annotation XML with Unicode Characters
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.