I am using ColdFusion 5 and trying to 开发者_Python百科convert special characters to utf-8 while creating xml file
I am using xmlFormat() for that, But when I parsing the xml file it is giving error like this:
Parsing xml failed:
mountainhomes/xdeadline_listings_wsj.xml:539: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0x96 0x31 0x28 0x32
5BA,open kitchen,dining & family area w/gas log fp.Lower level has 2 garages
                                                                     Â&n bsp;        ^
You can use a UDF like Demoronize (http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=725) to solve this. I use dpaste.org (Raw View) to find the offending character, get the proper ascii code, and add it to Demoronize to filter these garbage characters. Below are a list that I've added to the original UDF to take out Word quotes, elipses, etc.
text = Replace(text, Chr(96), "'", "All");
text = Replace(text, Chr(198), "'", "All");
text = Replace(text, Chr(8216), "'", "All");
text = Replace(text, Chr(8217), "'", "All");
text = Replace(text, Chr(8220), """", "All");
text = Replace(text, Chr(8221), """", "All");
text = Replace(text, Chr(8230), "...", "All");
text = Replace(text, Chr(244), """", "All");
text = Replace(text, Chr(246), """", "All");
text = Replace(text, Chr(8211), "-", "All");
精彩评论