HI ! ! !

I got this little problem, i can't properly insert japanese characters into my database

I already set the field to UTF8, and when I catch the form I do a quick echo to what I get and I see japanese chars, then I try inserting em into my table, but I get weird symbols there :/

If i insert japanese chars with phpmyadmin it won't be a problem

I already tryed utf8_encode($myfield) but it wont work :/

any other suggestion ?

	$pos = $_POST['pos']; // show chars
	$os = utf8_encode($pos); // testing
		mysql_query("INSERT INTO cms_test (asd) VALUES ('$os')"); //insert
		echo $pos;

    O_O ? I really don't know, im using a windows 2003 server, and im scared of using certain encodings , but as I said , the echo would display correctly the characters

      I just realized that the echo is not displaying properly the japanese characters, it is my OS X that is fixing the output

      I get this strange chars これは テストです :S

        What I found is that if I do not take care to safe all my scripts as UTF-8 that inserts are defaulted back to whatever encoding the script was in. In most editors you can set the type of encoding; I use ansi (UTF without header) which works;

        In general: Ensure that the whole 'flow of information' is set to UTF, from the form, the page, the processing code to the database fields

          all right =)

          my html has <meta> tag with the UTF8 enconding
          my php file is now in UTF8 encoding
          my database collation is utf8 and im sure the field in the table is utf8

          the only thing , im posting my values from the form with Javascript (sort of ajax)

          in firebug I see that the real japanese is being posted, if i echo the postfield i get the japanese, but if I try to insert into mysql it fails >_< , should I try a javascript encoding first ?

            Write a Reply...