Hello! I posted earlier about having problems with russian characters. I now have decided to move to UTF8, but can't seem to get this to work. My test system contains 3 scripts - an editor (a form), a storer, and a viewer. I seem to be able to get the stuff into the database in UTF8, but then I can't show it on screen - all I get is garbage. So I hope for some help here, preferrably hands-on :) The editor is just a form, with the following "specials": [code] <?php header("Content-type: text/html; charset=utf-8"); ?> <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> <form name="inputfrm" method="POST" action="lagra_txt.php" accept-charset="utf-8"> [/code] Despite specifying utf-8 in the accept-charset, I seem to get windows-1252. Why? On to the storer. Here I've got this: [code] // Connect to the DB using mysql_connect and mysql_select_db $sql = "SET NAMES 'utf8'"; mysql_query($sql); // The lines below were copied from an article on mysql.com - they check if I got UTF-8 $test = $_POST["charset_check"]; if (bin2hex($test) == "c3a4e284a2c2ae") $OK = true; elseif (bin2hex($test) == "e499ae") $OK = false; else die("Sorry, I didn't understand the character set of the data you sent!"); foreach ($_POST as $key => $val) { if ($key == "charset_check") continue; if ($val != "") { if (!$OK) $val = iconv("windows-1252", "utf-8", $val); $sql = "UPDATE luka_texter SET `Text`='".$val."' WHERE ID='".$key."' AND Sprak='ru'"; mysql_query($sql); } } [/code] As I said, this seems to get the stuff into the DB alright, and I think it's in UTF8 in there (at least it looks like junk, which is what UTF8 seems to me). The viewer is very simple, like this: [code] <?php header("Content-type: text/html; charset=utf-8"); ?> <html> <head> <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8"> <title>DB-edit</title> </head> <body> <?php // Connect to the DB using mysql_connect and mysql_select_db $sql = "SET NAMES 'utf8'"; mysql_query($sql); $sql = "SELECT ID, Text FROM luka_texter WHERE Sprak='ru'"; $res = mysql_query($sql) or die(mysql_error()); while ($rad = mysql_fetch_assoc($res)) print $rad["ID"]." ".iconv("utf-8", "windows-1252", $rad["Text"])."<br>"; mysql_free_result($res); ?> </body></html> [/code] The trouble I get is that some texts are truncated, some characters replace by question marks, and so on. So, can anyone point out where I do something wrong?