Skip to main content
Participant
September 5, 2006
Question

UTF-8

  • September 5, 2006
  • 3 replies
  • 1626 views
I have inserted data to MYSQL ver4 by Coldfusion MX-6 as UTF-8 but can not view them correctly. the thing which i see is only "?".
My site is Multi-language and I need to use the best encoding for that.

The thing which I was interested is I can see the inserted data by PHP normally but not by CFML.

Let me tell the exact problem:

A) When I use the following formatting, I can See the inserted data in MYSQL by ColdFusion and PHP Correctly but there are 2 mistakes
===========================================
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfprocessingdirective pageEncoding="utf-8">
<cfcontent type="text/html; charset=iso-8859-1">
===========================================
The problems are:
1- The Data which will insert in my DB will be HEX codes like: " &#1576..." which I think will incease MySQL Size. (I am Not Sure)

2- I need to write in HEX format for the Contetnt of my HTML Body. And this is too hard


B) I also Can use the following Codes"
===========================================
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfprocessingdirective pageEncoding="utf-8">
<cfcontent type="text/html; charset=UTF-8">
<cfscript>
SetEncoding("form", "iso-8859-1");
</cfscript>
===========================================
By these codes I can write in Content of HTML body easy (not with HEX Codes). and also I can read the inserted data in MySQL by PHP. BUT NOT IN COLDFUSION!!!! I mease instead of correct symbols I can see only "???????"

I realy confused.
This topic has been closed for replies.

3 replies

Inspiring
September 9, 2006
Behnamws wrote:
> MYSQL Setting is right. and if i use all encoding the same i can not insert
> the data in my DB.

there's something wrong then.

> the best encoding would be UTF-8. But when i set all encoding as UTF-8 It does
> not work.

it is the best encoding choice. it should work provided your db, etc. can
support unicode & are correctly setup to support unicode.

which db driver are you using? it can't be ODBC. for the JDBC driver, are you
using the following for the url (accessed via the advanced menu for that DSN in
cfadmin)?

using useUnicode=true&characterEncoding=utf8



BehnamwsAuthor
Participant
April 21, 2009

Hi,

There is a long time which i was absent.

Thanks alot for your helping. But i can not find the "useUnicode=true&characterEncoding=utf8" in CFadmin. Now I use CFML MX 7.

Inspiring
April 21, 2009

open the "advanced menu" for that DSN. add it in the "connection string" box.

BehnamwsAuthor
Participant
September 9, 2006
Thanks for the reply.
MYSQL Setting is right. and if i use all encoding the same i can not insert the data in my DB.
As I had explained I need to insert the data in FARSI. In that case I thought the best encoding would be UTF-8. But when i set all encoding as UTF-8 It does not work.
I insert to MY DB by a form which is designed by ColdFusion
Inspiring
September 5, 2006
Behnamws wrote:
> A) When I use the following formatting, I can See the inserted data in MYSQL
> by ColdFusion and PHP Correctly but there are 2 mistakes
> ===========================================
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> <cfprocessingdirective pageEncoding="utf-8">
> <cfcontent type="text/html; charset=iso-8859-1">
> ===========================================

if you can see the data w/this code then you have an encoding issue. all your
encoding hints should be teh same & if you're doing i18n work then it should be
utf-8. first off, is your database setup to handle utf-8? next, how did you add
the data to the db? what encoding was used?