Skip to main content
Inspiring
July 29, 2006
Question

encoding, charset, euro €

  • July 29, 2006
  • 6 replies
  • 1760 views
Hi,
Please can someone explain why my application is working...
I have a site that has users entering text from many countries so I want the most fool proof encoding I can get... utf-8 ?

I have read lots of posts in the forum that state the euro symbol € is not included in iso-8859-1. I have also read that the best encoding to use for mulit language sites is utf-8.

However with encoding currently set to iso-8859-1 in aplication.cfm everything is fine, the euro is € as it should be; code:
<cfheader name="Content-Type" value="text/html; charset=iso-8859-1">
<cfcontent type="text/html; charset=iso-8859-1">
<cfset setencoding("FORM", "iso-8859-1")>
<cfset setencoding("URL", "iso-8859-1")>

An upgrade is in progress to MySQL 5 so I have a chance to ensure things are as they should be. The tables are all set to charset -utf-8 and collation utf8_unicode_ci
BUT if I change the application.cfm code to utf-8 the euro € turns into a "?". Code:
<cfheader name="Content-Type" value="text/html; charset=utf-8">
<cfcontent type="text/html; charset=utf-8">
<cfset setencoding("FORM", "utf-8")>
<cfset setencoding("URL", "utf-8")>
<cfprocessingdirective pageEncoding="utf-8">

I obviously have not understood something about these encodings.... can someone enlighten me?

Regards,
Chris.



This topic has been closed for replies.

6 replies

Inspiring
August 31, 2006
I found that when I change the default charset of the MySQL 5 database to be utf8 my encoding problems go away. It was set as latin1.

So in MySql 5 I have now specified that the database, table, and column are all utf8.
I removed all references to iso-8859-1 from the Coldfusion pages and everything displays correctly (at least new data does, some updates to old data are required).

I had to use the MySQL command line to change the database default charset as i use a shared hosting provider.





Inspiring
August 12, 2006
micha wrote:
> I really don't know. I have to ask my hosting provider to set up each ODBC
> DSN. I will ask them right away (but expecting an aswer only by monday from
> them).

i'm no mysql expert but for i18n work we never use anything but JDBC drivers.

Participating Frequently
August 12, 2006
My previous host just used the MySQL 3.1 driver, and that worked, I think the new host also uses this...

Anyway, my problem is solved!

In my Application.cfm, I now only have this:
<cfset setEncoding("url","ISO-8859-1")>
<cfset setEncoding("form","ISO-8859-1")>
<cfcontent type="text/html; charset=ISO-8859-1">

On my page, I can put either <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> or <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"> or nothing at all. It just works! :-)

I don't know how it's possible, because I thought the euro sign wasn't supported in iso-8859-1...

Thank you for the quick answers!
Participating Frequently
August 12, 2006
>and is the encodng in the new mysql also iso-8859-15?

I'm trying to find that out right now. I always use webyog, but I can't find the encoding properties. But again, with PHP it shows up normally...

>what db driver is being used?

I really don't know. I have to ask my hosting provider to set up each ODBC DSN. I will ask them right away (but expecting an aswer only by monday from them).
Inspiring
August 12, 2006
micha wrote:
> <cfcontent type="text/html; charset=ISO-8859-15">

and is the encodng in the new mysql also iso-8859-15?

> When I get my data with PHP from my MySQL4 db, all euro signs and other
> special characters are being displayed normaly. So it must be a setting in CF
> MX 7 I guess.

what db driver is being used?
Participating Frequently
August 12, 2006
Hello,

I moved from a CF MX7 hosting provider to antoher CF MX 7 hosting provider.

Now, I'm having the same problem. All euro signs show up as ?'s.

In my Application.cfm I already had:
<cfset setEncoding("url","ISO-8859-15")>
<cfset setEncoding("form","ISO-8859-15")>
<cfcontent type="text/html; charset=ISO-8859-15">

Which displayed everyhing okay at my previous web hoster. But now, like a said, all euro signes are question marks. Also, all other characters like e grave and apostrophe are question marks.

When I get my data with PHP from my MySQL4 db, all euro signs and other special characters are being displayed normaly. So it must be a setting in CF MX 7 I guess.

Is there anyone with a solution to display euro signs and special characters normally in CF. I cannot replace all eurosigns in the db with &euro;.
Inspiring
July 29, 2006
cjdunkerley wrote:
> I have a site that has users entering text from many countries so I want the
> most fool proof encoding I can get... utf-8 ?

yes.

> I have read lots of posts in the forum that state the euro symbol ? is not
> included in iso-8859-1. I have also read that the best encoding to use for
> mulit language sites is utf-8.

yes it is.

> However with encoding currently set to iso-8859-1 in aplication.cfm everything
> is fine, the euro is ? as it should be; code:

i suspect that the encoding, etc. in your db is windows codepage 1252, which is
a superset of iso-8859-1. or you could be simply converting to/storing the html
entity instead of the actual char.

> <cfheader name="Content-Type" value="text/html; charset=utf-8">
> <cfcontent type="text/html; charset=utf-8">
> <cfset setencoding("FORM", "utf-8")>
> <cfset setencoding("URL", "utf-8")>
> <cfprocessingdirective pageEncoding="utf-8">

if this is old data, what else would you expect? it's stored as one encoding &
shown in another.