Hi,
I have problem in RevXMl. I cannot convert the unicode from the xml text.
Please test the attach livecode file.
I put the xml text in the field "Result"
I can use this scrip to get the unicode text
"set unicodetext of field "Test" to unicodetext of char 27 to 30 of line 9 of field "Result"
But if I use the revxml method I can not get the unicode text and only get unreadable character
Does I make something wrong, Please advise
Regards
Terry Ho
problem in revxml and unicode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
problem in revxml and unicode
- Attachments
-
- XmlUnicode.livecode.zip
- (2 KiB) Downloaded 251 times
Re: problem in revxml and unicode
Hi Terry Ho,
The first line of your XML data must be
I wrote about this in my book 
The mouseUp handler in your XML button should be
Kind regards,
Mark
The first line of your XML data must be
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

The mouseUp handler in your XML button should be
Code: Select all
on mouseUp
put "" into field "test"
// Create UTF8 formatted XML tree
put revCreateXmlTree(unidecode(the unicodeText of \
Field "Result","UTF8"), false, true, false) into tiD
put revXMLNumberofChildren(tID,"/Envelope/body/data","group", 0) into tNOC
put "" into tbuffer
repeat with tcount = 1 to tNOC
// retrieve UTF8 formatted data from XML tree
put revXMLNodeContents(tID, "/Envelope/body/data/group[" & \
tcount & "]/CHINESENAME") into adate
// tab and cr are the same in ASCII and UTF8
put aDate & tab & cr into bbuffer
put bbuffer after tbuffer
end repeat
// convert UTF8 to UTF16
set the unicodeText of fld "test" to uniEncode(tbuffer,"UTF8")
end mouseUp
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: problem in revxml and unicode
Hi
Thanks you help. I found the problem. Just as you said the Unicode problem
Regards
terry Ho
Thanks you help. I found the problem. Just as you said the Unicode problem
Regards
terry Ho