Need help with unicode and xml

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tsalagi
Posts: 3
Joined: Sat Jun 24, 2006 7:48 pm
Contact:

Need help with unicode and xml

Post by tsalagi » Sat Jun 24, 2006 8:19 pm

I have been developing a Cherokee-English dictionary for several years, and about a year ago, I decided I needed to store my data in xml format, so it can be converted to a dictionary server-useable format.

The problem is, I have one field in Cherokee syllabary (entered directly into my Revolution field), which needs to be saved in the xml file. I have read everything I can find about Rev and unicode, but I can't get anything to work correctly! I get garbage in my xml file every time.

I just renewed my Rev license after a long lapse, hoping that some progress has been made. I hope I didn't waste my money.

If anyone can help me, I would be grateful!


(Mac osx - Rev 2.7.2)[/i]

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Contact:

Post by Obleo » Sat Jun 24, 2006 11:11 pm

I also had similar issues until I picked up STS XML Library from Sons of Thunder. It is a reasonable priced and works so good.

If posting a link to it's web page is not good some let me know and I will edit the post, and remove it.

http://www.sonsothunder.com/products/xmllib/xmllib.htm

They have much info on the difference of this library and revolutions built in XML lib. I think revolution build in lib is great it does not do every thing that STS XML Lib does.

If someone else has a direct solution with run revs lib to fix your problem I still recommend checking out this helpful solution.

tsalagi
Posts: 3
Joined: Sat Jun 24, 2006 7:48 pm
Contact:

Thanks, this will help me with XML, but....

Post by tsalagi » Sun Jun 25, 2006 6:36 pm

This will help with my xml. The unicode, though, is still my biggest problem.

Why oh why did the developers decide to go with utf16, when the rest of the world uses utf8? I just don't get it!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jun 30, 2006 10:13 am

Dear Tsalagi,

Economy-x-Talk has a lot of experience with unicode and can help you. Maybe, we should find a non-xml solution. Please, write me off-list with a detailed description of the problems at support@economy-x-talk.com

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rol4leg
Posts: 7
Joined: Mon Jul 31, 2006 8:22 pm

Post by rol4leg » Fri Aug 04, 2006 1:06 am

**Dear Tsalagi,

**I use this code to generate my XML file in unicode

**GeneratedLfile is your ".xml" file
**field "PreXML" would be your "field in Cherokee syllabary" which should be written in XML of course

on mouseUp
---------------UTF8-------------------------
set useUnicode to true
put "C:\Documents and Settings\All Users\Documents\Revolution 1.1.1\" & GeneratedLfile into tPath
open file tPath for binary write
write uniDecode (bom() & the unicodeText of field "PreXML", "UTF8") to file tPath
close file tPath
--------------UTF8-----------------------

---------------UTF16-----------------------
open file tPath
read from file tPath until EOF
close file tPath
put it into myVariable
put uniEncode(myVariable,"UTF8") into field "PreXML"
delete file tPath
open file tPath for binary write
write field "PreXML" to file tPath
close file tPath
---------------UTF16-----------------------
end mouseUp


------------------------------------------------
function bom
set useUnicode to true
return numToChar(abs(baseConvert("FEFF",16,10)))
end bom
------------------------------------------------

**Best regards,

**rol4leg
Last edited by rol4leg on Sat Aug 05, 2006 1:03 am, edited 3 times in total.

DarScott
Posts: 227
Joined: Fri Jul 28, 2006 12:23 am
Contact:

Re: Need help with unicode and xml

Post by DarScott » Fri Aug 04, 2006 6:11 pm

tsalagi wrote:The problem is, I have one field in Cherokee syllabary (entered directly into my Revolution field), which needs to be saved in the xml file. I have read everything I can find about Rev and unicode, but I can't get anything to work correctly! I get garbage in my xml file every time.
Because of the way UTF-8 is encoded, the XML parsers just might work with that. Try converting your text and see.

Post Reply