#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2003
    Posts
    704
    Rep Power
    61

    CF and latin1 character sets


    Does anybody know how to make ColdFusion use the latin1 character set? We're trying to get Flash and MySQL talking to each other using ColdFusion and it keeps messing up the non-english characters. From what I've read, it uses UTF8 by default, however that's not supported by MySQL right now. I think it will be in 4.1, however everything I've seen suggests that it's broken. Using a cfcontent type may not work since we're planning on using cfc's.
    blockcipher
    ---------------
    Gratuitously stolen...
    mysql> SELECT * FROM user WHERE clue > 0;
    0 Results Returned.

    PHP5/MySQL/UTF-8
    My Tech Blog
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    You can do different character sets in ColdFusion MX by placing:

    <cfprocessingdirective pageencoding="UTF-8">

    at the top of whatever page you want to handle UTF encoding.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2003
    Posts
    704
    Rep Power
    61
    Well, that didn't help. I tried it in every file that I could be it a cfc or a regular cfm and nothing helped. When I look at a cfm file, Firebird still thinks it's UTF-8. Is there any way to put UTF-8 data in MySQL and have ColdFusion read it back as UTF-8? I tried a few things like using a blob instead of text, but that only caused problems.
    blockcipher
    ---------------
    Gratuitously stolen...
    mysql> SELECT * FROM user WHERE clue > 0;
    0 Results Returned.

    PHP5/MySQL/UTF-8
    My Tech Blog
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    My bad, I didn't see that CF is only pulling the data from MySQL and forwarding it to Flash. Yes, this is definitely a MySQL issue, not a ColdFusion one. I believe you are right that the current version of MySQL does not support UTF encoding. There's nothing that CF can do about it, it can only use what's in the database. For sure if you are using ColdFusion MX it supports UTF encoded characters, so until you can get the data in and out of MySQL in the right format there's nothing that can be done other than switching databases of course. Maybe Postgre?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2003
    Posts
    704
    Rep Power
    61
    Damn...that was not the answer I was hoping for. As for alternatives, we're locked in to MySQL by our customer's support contractor. I do thank you for your time.
    blockcipher
    ---------------
    Gratuitously stolen...
    mysql> SELECT * FROM user WHERE clue > 0;
    0 Results Returned.

    PHP5/MySQL/UTF-8
    My Tech Blog
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Winston Salem, NC
    Posts
    2
    Rep Power
    0

    It will work, but you can't use ODBC use JDBC instead.


    You can make the page you want to work work. You just have to use JDBC instead of ODBC. Setup a folder and place the JConnector java jar files into the directory. Next update your Java classpath from the Cold fusion interface to include the 3 jars. 2 from lib and the 1 mysql jar. Next, restart your cold fusion server. Now, go to setup a connection. You will put in your usual options then you will have to put this in the connectionstring section.....
    for example:
    replace below values with your respective values.....
    Database=test
    Server=192.168.1.10
    username=someuser
    password=somepassword

    Under Advanced Settings
    ConnectionString=
    jdbc:mysql://192.168.1.10/test?user=someuser&password=somepassword&useUnicode=true&characterEncoding=latin1


    That should do the trick.

    It's pretty simple just read carefully. Java supports unicode natively, so of course the java drivers can support it. The problem was the C API's in the ODBC driver. The next ODBC driver should have Uni support so they say, but who knows. Good luck, this setup is working fine for me.

    Wade
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Winston Salem, NC
    Posts
    2
    Rep Power
    0

    MySQL and Unicode.


    Yes MYSQL itself supports unicode. You can manipulate the date using MyCC and can put in an character you want and get them back out as they were entered. MyCC uses mysql api's though. The odbc driver is a little less useful however. Just thought you might like to be informed that MySQL itself supports unicode fine.

IMN logo majestic logo threadwatch logo seochat tools logo