In an XML-File I've the following part
<headline>FOKUS 1-Tochter stoppt Vorstoß des Ölmultis BP in die Arktis</headline>
when I try to read this data with the following statement:
local tHeadLine
put revXMLNodeContents(pTree, "newsMessage/itemSet/newsItem/contentMeta/headline") into tHeadLine
I get in the variable "tHeadLine" the following text:
FOKUS 1-Tochter stoppt Vorstoß des Ölmultis BP in die Arktis
How i it possible to read with "revXMLNodeContents" and holding the spezial characaters ??
Reading special characters with revXMLNodeContents
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Reading special characters with revXMLNodeContents
Hi mjaspaert,
Probably, you XML file is encoded as UTF8 (or maybe UTF16) and externals don't work with data that contains binary characters. Try encoding it as Windows Latin or MacRoman (depending on your OS) using the following syntax:
Replace UTF8 with UTF16 if your file is encoded as UTF16. Now you should be able to use myXMLData with the external.
Another possibility is that your XML file is ancoded as MacRoman while you are on a Windows PC, which means that LiveCode expects Windows Latin. To convert the file from Mac to Win you can use
and to convert from Win to Mac use
Kind regards,
Mark
Probably, you XML file is encoded as UTF8 (or maybe UTF16) and externals don't work with data that contains binary characters. Try encoding it as Windows Latin or MacRoman (depending on your OS) using the following syntax:
Code: Select all
put url "binfile://path/to/xml.file" into myXMLData
put unidecode(uniencode(myXMLData,"UTF8"),"English") into myXMLData
Another possibility is that your XML file is ancoded as MacRoman while you are on a Windows PC, which means that LiveCode expects Windows Latin. To convert the file from Mac to Win you can use
Code: Select all
put macToIso(myXMLData) into myXMLData
Code: Select all
put isoToMac(myXMLData) into myXMLData
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: Reading special characters with revXMLNodeContents
hello mark,
thank you for this hint. It works fine.
regards marcel
thank you for this hint. It works fine.
regards marcel