Question
Problem inserting special Hungarian characters into db
Hi,
I've posted this question in the database connection forum but put it here too because I don't know where to fit better.
I read that it would be the most straightforward way to do everything in UTF-8 because it handles well special characters so I've tried to set up a simple testing environment. Besides I use CF MX7 and my hosting provider creates the dsn for me so I think the db driver is JDBC but not sure.
1.) In Dreamweaver I created a page with UTF-8 encoding set the Unicode Normalization Form to "C" and checked the include unicode signature (BOM) checkbox. This created a page with the meta tag: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />. I've checked the HTTP header with an online utility at delorie.com and it gave me the following info:
HTTP/1.1, Content-Type: text/html; charset=utf-8, Server: Microsoft-IIS/6.0
2.) Then I put the following codes into the top of my page before everything:
<cfprocessingdirective pageEncoding = "utf-8">
<cfset setEncoding("URL", "utf-8")>
<cfset setEncoding("FORM", "utf-8")>
<cfcontent type="text/html; charset=utf-8">
3.) I wrote some special Hungarian chars (<p>őű</p>) into the page and they displayed well all the time.
4.) I've created a simple MySQL db (MySQL Community Edition 5.0.27-community-nt) on my shared hosting server with phpMyAdmin with default charset of UTF-8 and choosing utf8_hungarian_ci as default collation. Then I creted a MyISAM table and the collation was automatically applied to my varchar field into wich I stored data with special chars. I've checked the properties of the MySQL server in MySQL-Front prog and found the following settings under the Variables tab: character_set_client: utf8, character_set_connection: utf8, character_set_database: latin1, character_set_results: utf8, character_set_server: latin1, character_set_system: utf8, collation_connection: utf8_general_ci, collation_database: latin1_swedish_ci, collation_server: latin1_swedish_ci.
5.) I wrote a simple insert form into my page and tried it using both the content of the form field and a hardcoded string value and even tried to read back the value of the #FORM.special_char# variable. In each cases the special Hungarian chars changed to "q" or "p" letters.
Can anybody see something wrong in the above mentioned or have an idea to test something else?
I am thinking about to try this same page against a db on my other hosting providers MySQL server.
Here is the to the form: http://209.85.117.174/pages/proba/chartest/utf8_1/form.cfm
Thanks, Aron
I've posted this question in the database connection forum but put it here too because I don't know where to fit better.
I read that it would be the most straightforward way to do everything in UTF-8 because it handles well special characters so I've tried to set up a simple testing environment. Besides I use CF MX7 and my hosting provider creates the dsn for me so I think the db driver is JDBC but not sure.
1.) In Dreamweaver I created a page with UTF-8 encoding set the Unicode Normalization Form to "C" and checked the include unicode signature (BOM) checkbox. This created a page with the meta tag: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />. I've checked the HTTP header with an online utility at delorie.com and it gave me the following info:
HTTP/1.1, Content-Type: text/html; charset=utf-8, Server: Microsoft-IIS/6.0
2.) Then I put the following codes into the top of my page before everything:
<cfprocessingdirective pageEncoding = "utf-8">
<cfset setEncoding("URL", "utf-8")>
<cfset setEncoding("FORM", "utf-8")>
<cfcontent type="text/html; charset=utf-8">
3.) I wrote some special Hungarian chars (<p>őű</p>) into the page and they displayed well all the time.
4.) I've created a simple MySQL db (MySQL Community Edition 5.0.27-community-nt) on my shared hosting server with phpMyAdmin with default charset of UTF-8 and choosing utf8_hungarian_ci as default collation. Then I creted a MyISAM table and the collation was automatically applied to my varchar field into wich I stored data with special chars. I've checked the properties of the MySQL server in MySQL-Front prog and found the following settings under the Variables tab: character_set_client: utf8, character_set_connection: utf8, character_set_database: latin1, character_set_results: utf8, character_set_server: latin1, character_set_system: utf8, collation_connection: utf8_general_ci, collation_database: latin1_swedish_ci, collation_server: latin1_swedish_ci.
5.) I wrote a simple insert form into my page and tried it using both the content of the form field and a hardcoded string value and even tried to read back the value of the #FORM.special_char# variable. In each cases the special Hungarian chars changed to "q" or "p" letters.
Can anybody see something wrong in the above mentioned or have an idea to test something else?
I am thinking about to try this same page against a db on my other hosting providers MySQL server.
Here is the to the form: http://209.85.117.174/pages/proba/chartest/utf8_1/form.cfm
Thanks, Aron