2

i have a proble, when insert something in foreign language into database. i have set the collation of database to utf8_general_ci(try utf8_unicod_ci too). but when i insert some text into table, it was saved like this

Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶ Ô±Õ¶Õ¸Ö‚Õ¶

but when i read from database, text shows in correct form. it looks like that only in database.

i have set encoding in my html document to charset=UTF-8

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

and i set

mysql_query("SET NAMES UTF-8");
mysql_query("SET CHARACTER SET UTF-8");

when conecting to database. so i think that i' ve done everything, but it still save in that anknown format. could you help me. thanks in advance

3 Answers 3

2

I believe you have to SET NAMES utf8, instead of UTF-8, in MySQL.

Sign up to request clarification or add additional context in comments.

2 Comments

i don't ubderstand. rewrite please
Try mysql_query("SET NAMES utf8");.
1

It looks like maybe your phpmyadmin isn't using the correct charset. In your phpmyadmin folder, open config.default.php and edit the lines

$cfg['DefaultCharset'] = 'iso-8859-1';
$cfg['DefaultLang'] = 'en-iso-8859-1';

To your chosen encoding.

5 Comments

@adam can i do that by some functions?( like ini.set() in php), because i haven't permission to change them on the hosting!
I don't think so. It should pick up the encoding automatically (and correctly). You could contact your host or install your own copy.
@adam but there isn't any config.default.php file. only config.inc.php and config.sample.inc.php.
@adam there aren't such thing in both of them:(
Ok. If it's there, it might be under a different name. It's really not my area, so you'll have to have a look about
0

It is suggested to use mysql_set_charset() instead of "SET NAMES" query, however the impact should be the same.

1 Comment

@naivists what is the difference?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.