c# - Unable to open/read XML file containing accented characters -
i have xml attribute containers accent characters:
<testcase name="canadian addresses - test case" description="canadian addresses - test case" onoff="true" negativetest="false" rollbackdb="false" performance="false" performancesummary="false" timestoexecute="1"> <providerfacilitysearch_findproviderfacility providerinfo="dr marc-andré kärcher samuels senior|10 château du feÿ ave, north building, north sydney, ns b2a 3l7 canada" /> <providerfacilitysearch_viewproviderfacility providerinfo="dr marc-andré kärcher samuels senior|10 château du feÿ ave, north building, north sydney, ns b2a 3l7 canada" /> <viewprovider_locationname expectedlocationname="kärcher health care" /> <viewprovider_servicingaddress expectedservicingaddress="10 château du feÿ ave|central building|north sydney, ns b2a 3l7|canada" /> <viewprovider_expandmailingaddress na="" /> <viewprovider_mailingaddress expectedmailingaddress="10 château du feÿ ave|central building|north sydney, ns b2a 3l7|canada" /> <viewprovider_expandbillingaddress na="" /> <viewprovider_billingaddress expectedbillingaddress="10 château du feÿ ave|central building|north sydney, ns b2a 3l7|canada" /> <viewprovider_close na="" /> <providerfacilitysearch_cancel na="" /> <userlogout/> </testcase>
when try read xml file using c# code, i'm getting:
5/8/2013 2:39:03 pm error: system.xml.xmlexception: invalid character in given encoding. line 86, position 74. @ system.xml.xmltextreaderimpl.throw(exception e) @ system.xml.xmltextreaderimpl.throw(string res, string arg) @ system.xml.xmltextreaderimpl.invalidcharrecovery(int32& bytescount, int32& charscount)
i can't open page using ie.
is there way work?
use header:
<?xml version='1.0' encoding='iso-8859-1'?>
edit
the encoding declaration identifies encoding used represent characters in xml document. although xml parsers can determine automatically if document uses utf-8 or utf-16 unicode encoding, declaration should used in documents support other encodings.
Comments
Post a Comment