简体   繁体   中英

last gasp with MySQL character encoding, strange characters

When I view a word with an "ø" in it in phpMyAdmin, I see the "ø" correctly, but when i gets delivered to my html page, I see "ø".

I have tried every bt of advice I can find on stackoverflow and everywhere else (and read the article "the bare minimum every developer must know...", but I can't seem to figure this out (list below). What am I missing?

Mysql:

mysql_query("SET character_set_results = 'utf8'");
mysql_query("SET character_set_client = 'utf8'");
mysql_query("SET character_set_connection = 'utf8'");
mysql_query("SET character_set_database = 'utf8'");
mysql_query("SET character_set_server = 'utf8'");
mysql_query("SET NAMES UTF8");

.htaccess

AddDefaultCharset UTF-8

PHP:

declare(encoding='UTF-8');
ini_set('default_charset', 'utf-8');
header('Content-Type: text/html; charset=utf-8');
header('Accept-Charset: utf-8');
header('Accept: text/html');

mb_language('uni');
mb_internal_encoding('UTF-8');

iconv_set_encoding("input_encoding", "utf-8");
iconv_set_encoding("internal_encoding", "utf-8");
iconv_set_encoding("output_encoding", "utf-8");

HTML

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

When I show page info in firefox, it says encoding is utf-8. All of my scripts are written in utf-8 encoded pages.

What gives? I can't think of anything else to do. Are there some tests i can run?

Thanks for any insi

When I've had similar problem, only setting the MySQL database to UTF-16 helped. Maybe it will help in your case too?

found my problem. I was calling html_entities on the string before showing it. I'm an idiot. Thanks for your help. Shows fine now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM