array007
asked on
Dealing with both US alpha and French accentuated characters
I have a need to be able to enter in the same DB field both US characters and French accentuated char as the content could be in FR or US English.
As is I tried to set my charset to utf-8
and DB field to utf-8 too
tried also before inserting utf8_encode($str) to no avail
here is the result for example I tried a 4 char words with accent on the 4th char
only the three first char are found in the field the last one is gone.
I thought it might be related to my CleanDb() safe insert function but that is not the case, so I have no idea.. any clue?
thanks
As is I tried to set my charset to utf-8
and DB field to utf-8 too
tried also before inserting utf8_encode($str) to no avail
here is the result for example I tried a 4 char words with accent on the 4th char
only the three first char are found in the field the last one is gone.
I thought it might be related to my CleanDb() safe insert function but that is not the case, so I have no idea.. any clue?
thanks
Could you post or attach the results? Did you make test entering values directly to DB?
ASKER
There are no results I can attach as it really is as explained
and YES the DB accepts direct insert with the accent
However the resulting output (site page) shows that "diamond" thing instead of the accentuated letter
but the page has a utf-8 charset so what could be wrong?
thanks
and YES the DB accepts direct insert with the accent
However the resulting output (site page) shows that "diamond" thing instead of the accentuated letter
but the page has a utf-8 charset so what could be wrong?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and DDL for table:
CREATE TABLE `testutf` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`testutf` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MYISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
CREATE TABLE `testutf` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`testutf` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MYISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
As I do not know which PHP version you use, this is older command to set connection charset:
mysql_query("SET NAMES 'utf8'",$link);
This is actually MySQL coomand.
mysql_query("SET NAMES 'utf8'",$link);
This is actually MySQL coomand.
ASKER
Thanks, well explained!