9 Replies Latest reply on Nov 17, 2008 11:25 AM by tomtomtom

    Character encoding with CF and MySQL

      Okay, I thought this should be rather straight forward but apparently not. I have set up my site to use UTF-8— my cfm pages, the MySQL table, even Dreamweaver. The problem is when I input international character via a form they get written correctly to the MySQL table; however, when I retrieve them in a query and display them on the page I get them displayed incorrectly.

      On my input.cfm page I'll enter the string "Téstïñg" in the textbox and submit it. If I look at the record via the MySQL Browser it appears as it should. However when I display it on my output.cfm page it shows the record as "T�st��g" and will do so until I change the meta tag to use charset=ISO-8859-1. Am I missing something or is this how it is suppose to work?

      My input.cfm page is set up with both the
      <cfprocessingdirective suppresswhitespace="YES" pageencoding="UTF-8">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      tags and a regular input formfield that writes to the MySQL database.

      The MySQL table is configured to use the utf8 char set and utf8_unicode_ci collation.

      And just to be safe I included useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 in the connection string on the CF Admin datasource setup page.

      I'm running CF 6.1, MySQL 4.1, the latest version of Apache Server on a Win2K3 box. I was running the 3.0.16 MySQL JDBC driver but I upgraded it to the 5.0.6 this morning thinking that may fix my issue.