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.
PaulH **AdobeCommunityExpert** - 29 Jul 2006 12:30 GMT
> 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.
micha - 12 Aug 2006 12:16 GMT
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 €.
PaulH **AdobeCommunityExpert** - 12 Aug 2006 12:29 GMT
> <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?
micha - 12 Aug 2006 12:35 GMT
>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).
PaulH **AdobeCommunityExpert** - 12 Aug 2006 12:51 GMT
> 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.
micha - 12 Aug 2006 13:50 GMT
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!
PaulH **AdobeCommunityExpert** - 13 Aug 2006 05:15 GMT
> 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!
i think it's still there just messed up in another form.
> I don't know how it's possible, because I thought the euro sign wasn't
> supported in iso-8859-1...
it's not. you have still an encoding issue. i suspect it's your mysql driver
and/or db encoding. it will resurface sooner or later.
micha - 14 Aug 2006 12:06 GMT
Okay, but the eurosign does show up. It must be the Windows subset of 8859-1
which you mentioned in another thread, that is displaying the eurosign.
Thanks fort the tip, I will look into the driver/db encoding the next time,
and make sure these are correct.
PaulH **AdobeCommunityExpert** - 14 Aug 2006 13:04 GMT
> Okay, but the eurosign does show up. It must be the Windows subset of 8859-1
> which you mentioned in another thread, that is displaying the eurosign.
technically windows-1252 codepage is a *superset* of iso-8859-1 (or latin-1).
that's why it's tricky to deal with, it looks like it's the same but it's got
more/different chars in it.
cjdunkerley - 31 Aug 2006 17:20 GMT
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.