Jump to content

ctiberg

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ctiberg's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I had a rave reply in this textbox, until I tried it out on the production server. There, it has the same problems as my own attempts. That is it gets most of the text right, but some of it is replaced by ?'s.... So I'll try to get a response out of our provider, which I guess will prove very futile. Sigh.
  2. The input is from a form (I gave you the form element syntax above), containing some 40-50 text strings that's been translated into russian from english. I copy them from an Excel sheet one at a time, and then paste them into each form field. Each form field is given a name that is then used as the ID in the MySQL table. This is of course a very simple example, but I need this to work before I go on to the rest of the site.
  3. Everything is set to latin1 when I do the above in MyDB Studio, except for character_set_system, which is set to utf8. The Text column have had its character set to UTF8, though, using: DROP TABLE IF EXISTS `luka_texter`; CREATE TABLE `luka_texter` (   `ID` varchar(50) NOT NULL default '',   `Sprak` char(2) NOT NULL default '',   `TEXT` text CHARACTER SET utf8,   PRIMARY KEY  (`ID`,`Sprak`) ) ENGINE=MyISAM DEFAULT CHARACTER SET=latin1;
  4. 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?
  5. Hi there! Thanks for your reply... I thought about trying to get the browser to give me the text in the right codepage, and that's my first question. Is it an attribute of the <form> element that needs to be changed? If that doesn't work, I might try going to UTF-8 for the text. But even then, I would need to tell the browser to submit UTF8, right? I know how to specify a character set for a whole table in MySQL, so that part is taken care of (I think, I might need more later).
  6. The below is a sample - it's russian for "Contact information". Each character is represented by its HTML entity. &#1082;&#1086;&#1085;&#1090;&#1072;&#1082;&#1090;&#1085;&#1072;&#1103; &#1080;&#1085;&#1092;&#1086;&#1088;&#1084;&#1072;&#1094;&#1080;&#1103;
  7. Hello! We've always been working with english and swedish pages, but have now gotten work with a russian site. The server and MySQL databases are using the latin1 codepage, while the russian text (I think) is in cp1251. When we post a form with russian text, it's translated into html entities (like &1332;). This is far from ideal. So does anyone know what to do to avoid that translation? Please try to be as specific as possible, this is all new ground to me!
×
×
  • 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.