Question
UTF-8 encoding Funny characters in DB
Dear All,
I am Facing a Critical issue which has been lagging, dragging from 3 days, still couldn't figure out an issue
I've an XML file which am Getting it from a Server using
<cffile action="READ" file="#application.settings.paths" variable="xml" charset="utf-8">
and using an XMLPARSE to parse that xml and trying to insert that xml data into Database, in XML i've these
characters master ’s, which should be like a single quote encoded like this but when saving to Database
using a coldfusion query, Data is saving as some Funny Characters (i.e., master ?s),
xml encoding is in UTF-8 and i don't know how to convert that zunk characters to normal characters like ( master's) - single quote)
here are the things i tried.
*****************
in Coldfusion Administrator i added a Connection String "useUnicode=true&characterEncoding=UTF-8"
and checked the box which says " enable unicode for datasources configured for non-latin characters"
*****************
I am Facing a Critical issue which has been lagging, dragging from 3 days, still couldn't figure out an issue
I've an XML file which am Getting it from a Server using
<cffile action="READ" file="#application.settings.paths" variable="xml" charset="utf-8">
and using an XMLPARSE to parse that xml and trying to insert that xml data into Database, in XML i've these
characters master ’s, which should be like a single quote encoded like this but when saving to Database
using a coldfusion query, Data is saving as some Funny Characters (i.e., master ?s),
xml encoding is in UTF-8 and i don't know how to convert that zunk characters to normal characters like ( master's) - single quote)
here are the things i tried.
*****************
in Coldfusion Administrator i added a Connection String "useUnicode=true&characterEncoding=UTF-8"
and checked the box which says " enable unicode for datasources configured for non-latin characters"
*****************
- Used a ConvertCharset Function passing xml object .. [/li]
*****************
ii)
<cfscript>
function convertCharset(str,charsetFrom,charsetTo)
{
var resultStr="";
var javaString="";
var byteArray="";
javaString = CreateObject("java", "java.lang.String");
javaString.init(str);
byteArray = javaString.getBytes(charsetFrom);
resultStr = CreateObject("java", "java.lang.String");
resultStr.init(byteArray,charsetTo);
return resultStr.toString();
}
</cfscript>
*****************
-
<cfcontent type="text/html; charset=UTF-8">
<cfset setEncoding("URL", "UTF-8")>
<cfset setEncoding("Form", "UTF-8")>
tried this method also http://www.bennadel.com/blog/1206-Content-Is-Not-Allowed-In-Prolog-ColdFusion-XML-And-The-Byte-Order-Mark-BOM-.htm[/b
*****************
Please let me know if i need to do anything.. other than the above methods,
Thanks
