I make a soap webservices call with coldfusion and get back a UTF-8 encoded response and save it as an xml file.
<cfset a = createObject("webservice","https://somesite/service?wsdl")/>
<cfset b = a.getObject("Param1","Param2","Param3","ObjectN开发者_如何转开发ame")/>
<cfset c = b.getXml()/>
<cffile action="write" file="#ExpandPath('./result.xml')#" output="#c#"/>
When I open the file in a text editor i see
<?xml version="1.0" encoding="UTF-8"?>
<report>
<report_row>
...
<c43>... an “experimental� ...</c43>
...
</report_row>
</report>
instead of “experimental” and when I try to open it with a browser I get encoding errors.
How do I get the data in right format/encoding?
See in the database or what ever file from which you are getting this 'experimental'. There may be something of an extra character lurking there like special quote symbol.
Try adding charset="utf-8"
to your <cffile />
tag. More information in the livedocs.
精彩评论