Skip to main content
Participating Frequently
March 10, 2008
Question

Broken Unicode

  • March 10, 2008
  • 12 replies
  • 843 views
Never thought I would have a problem with unicode, but here it is.

The web site I am working on is ColdFusion MX7 and mySQL 5.0.45. The data in the DB is UTF-8 encoded, collation is set to utf8_general_ci. The output of the data from DB is valid, all characters are displayed properly.

Problem starts when I try to update records via site's web interface. I have attached a piece of code as an example (the whole query is rather large) to show that there is no charset messing in the query itself. However, whenever I post unicode characters (the site is bilingual, English and Russian) they get converted to something weird. For example, small Russia letters "a" converted into number 0, "b" into number 1 and so on. So whenever I try to post something like "Колбаса" - I get a bunch of numbers and symbols, some of which are invisible.
I talked to the hosting support for 2 days already, but they still "investigating", which sort of leads me to think they have no clue.
This topic has been closed for replies.

12 replies

Participating Frequently
March 10, 2008
application.cfm already has:

<cfcontent type="text/html; charset=UTF-8">
<cfset setEncoding("URL", "UTF-8")>
<cfset setEncoding("Form", "UTF-8")>

I also tried using in the page that posts data to the server, common include and application.cfm

<cfquery datasource="skazkaf_skazka">
SET CHARACTER SET UTF8
</cfquery>
<cfquery datasource="skazkaf_skazka">
SET NAMES 'UTF8' COLLATE 'utf8_general_ci'
</cfquery>

How do I tell the driver version? This is a shared hosting, the DSN connection was set up by support.
Inspiring
March 10, 2008
try including the following in your Application.cfm/cfc:
<cfscript>
SetEncoding("form","utf-8");
SetEncoding("url","utf-8");
</cfscript>

which mysql drivers are used to connect to the db?


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/