How to create a UTF-8 XML file with rev?

Malte Brill revolution at derbrill.de
Fri Apr 17 05:29:59 EDT 2009


Moin Tiemo,

this should get you started (mind linewraps):

  put encodeUtf8("<?xml version=" & quote & "1.0" & quote & "  
encoding=" & quote & "UTF-8" & quote & "?><request name=" & quote &  
pAction & quote & "></request>") into tData
     put revCreateXMLTree(tData, true, true, false) into tId

function decodeUtf8 pContents
     local tContents
     put unidecode(uniencode(pContents,"UTF8"),"english") into tContents
     if chartonum(the last char of tContents)=10 then delete the last  
char of tContents
     return tContents
end decodeUtf8

function encodeUtf8 pContents
     return unidecode(uniencode(pContents, "english"), "UTF8")
end encodeUtf8

Make sure to encodeUTF8 when you put your data into the XML and to  
decode when you retrieve it.

Hth,

Malte	



More information about the use-livecode mailing list