Jump to content

UTF8 encoding accent headache


marchost

Recommended Posts

Hi, i'm having a weird problem with UTF-8 accent.

 

Basically, I have a form that saves post data to a mysql database.

 

Let say I type in 'André', eveything is displayed correctly on the page but it get saved as André in the database. My only concern is in the database, on the user side eveything is normal.

 

If I go directly in phpmyadmin and manually replace 'André' with 'André' it still display info correctly on the page.

 

Forums are really my last resort, I looked for an answer for hours.

 

I have tried the following but I get the same result:

 

-httpd.conf-

AddCharset UTF-8 .utf8

AddDefaultCharset UTF-8

 

-php.ini-

default_charset = "utf-8"

 

-my.cnf-

character-set-server=utf8

default-collation=utf8_unicode_ci

 

But if I do mysql_query("SET NAMES 'utf8'"), the data is displayed as André on the user side and in the database.

 

Also, if I echo posted data it is displayed as 'André' or if I echo the query on the page, I get again 'André'

 

Basically, my problem seems to be between php and mysql...

 

Thanks in advance for any answers

Marc

http://www.ipinfodb.com/

Link to comment
https://forums.phpfreaks.com/topic/161860-utf8-encoding-accent-headache/
Share on other sites

sorry, i meant iconv()

 

$text = "André";
echo iconv("UTF-8", "ISO-8859-1", $text);

 

UTF-8|ASCII Unicode

Big5|Traditional Chinese

GB2312|Simplified Chinese

EUC-JP|Japanese

EUC-KR|Korean

KOI8-R|Russian

ISO-8859-1|Latin 1(West European)

ISO-8859-2|Latin 2(East European)

ISO-8859-3|Latin 3(South European)

ISO-8859-4|Latin 4(North European)

ISO-8859-5|Cyrillic

ISO-8859-6|Arabic

ISO-8859-7|Greek

ISO-8859-8|Hebrew

ISO-8859-9|Turkish

ISO-8859-10|Nordic

ISO-8859-15|Latin 1(French, Finnish)

windows-874|Thai

 

i'm not very familiar with all the charsets, u probably have to explore the list to get the right one or let an expert point u in the right direction. The link is here:

http://us2.php.net/manual/en/function.iconv.php

I am pretty sure iconv() is the right function to use though :P

Ted

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.