I have problem to create an XML file which contain unicode font
i create a script in card and button to generate an XML file
this is my CARD SCRIPT
Code: Select all
local _tags
local _xml
local _level
local _tabs
function q pText
return quote & pText & quote
end q
on startXML
//put "<?xml version=" & q("1.0") & "?>" & return into _xml
put "<?xml version=" & q("1.0") & " encoding=" & q("UTF-8") & "?>" & return into _xml
/*
versionnya pengen diupgrade ke 1.1 pake code ini
?xml version="1.1" encoding="UTF-8"?
*/
put 0 into _level
put empty into _tabs
put empty into _tags
end startXML
on startTag pTag
put _tabs & "<" & pTag & ">" & return after _xml
add 1 to _level
put pTag into _tags[_level]
put tab after _tabs
end startTag
on closeTag
delete char 1 of _tabs
put _tabs & "</" & _tags[_level] & ">" & return after _xml
# Do a 'delete variable _tags[_level]' if you really want to clean the array as you go
subtract 1 from _level
end closeTag
on addAttribute pAttribute, pValue
# This should go into the last tag, but as we have "proper XML" so far we can backtrace two chars (">" and newline)
put space & pAttribute & "=" & q(pValue) before char -2 of _xml
end addAttribute
on writeContent pContent
put _tabs & pContent & return after _xml
end writeContent
on writeNode pNode, pValue
put _tabs & "<" & pNode & ">" & pValue & "</" & pNode & ">" & return after _xml
end writeNode
getProp xml
return _xml
end xml
this is the script
Code: Select all
on mouseUp
startXML
startTag "DracoFootballXpression"
startTag "General"
//NAMA TIM
startTag "TeamName"
writeNode "HomeNameSmall", field "namatima_skt_fld" of card 002
writeNode "HomeNameBig", field "namatima_fld" of card 002
writeNode "AwayNameSmall", field "namatimb_skt_fld" of card 002
writeNode "AwayNameBig", field "namatimb_fld" of card 002
.
.
.
.
.
closeTag // Draco Football Xpression
put the xml of this card into URL "file:C:/DracoXpression/DracoData.xml"
and push GENERATE button
here the result of XLM file
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<DracoFootballXpression>
<General>
<TeamName>
<HomeNameSmall></HomeNameSmall>
<HomeNameBig>?UKANOVI?</HomeNameBig>
<AwayNameSmall></AwayNameSmall>
<AwayNameBig></AwayNameBig>
</TeamName>
.
.
.
.
when i check it with notepad this is not a unicode XML. this is ANSI
what I want is to be like this
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<DracoFootballXpression>
<General>
<TeamName>
<HomeNameSmall></HomeNameSmall>
<HomeNameBig>"ĐUKANOVIĆ"</HomeNameBig>
<AwayNameSmall></AwayNameSmall>
<AwayNameBig></AwayNameBig>
</TeamName>
.
.
.
.
How to create an unicode XML file?
comment and help wouldbe appreciate
Thanks
Gilar Kadarsah
Newbie Programmer from Indonesia