I am no coder by any means… but what is the encoding on the page where your online form collects the data? If it s NOT utf-8, then what do you expect?
EDIT. This one is also a good read: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
Add this to your webpage’s HEAD section:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
(That should all be on one line, no breaks)
Alternatively, configure your webserver to send a UTF-8 content type in the http headers.
The following is the head of the input page:
<head>
<title>Media Admin Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
As for the server, WP is installed on the same server. In fact, the Media DB table I put together is in the same DB as WP. I have no problem typing Japanese and English on WP. There must be some code for passing characters that I am not putting into my form…
If you don’t force the encoding, and in Firefox right click and go to “View Page Info”, what does the encoding show up as?
I commented out the encoding on all pages (admin, japanese output and english output) and then did what you said in Firefox and it told me: ISO-8859-1
Something I should mention, this is written in perl, not PHP. I don’t know if that has an effect on the outcome. I was hoping it was just encoding.
EDIT: Also, looking up the db on phpMyAdmin the MySQL charset is UTF-8 and MySQL connection collation is utf8_unicode_ci
I guess Otto didn’t suggest to comment out the charset metatag, but to look at the page without setting your browser to utf-8 and see what is the encoding that it gets automatically…
Oh! Okay, well I tried that and got the same thing: ISO-8859-1
So the meta tag isn’t forcing the charset to actually change… what to do?
A few things:
a) The meta tag needs to be closed. So either change the end to /> or add a </meta> after it. Always close all tags.
b) UTF-8 should be capitalized. iso-8859-1 should not.
c) If you are writing this as a script, just set the Content-Type header directly. It should be “text/html; charset=UTF-8”. In PHP, I would do this with:
header("Content-Type: text/html; charset=UTF-8");
before any output was made, so probably right at the top of the script. I do not know what the Perl equivalent of this would be.
Well, I closed the tag but in FF the encoding still comes up as ISO-8859-1. (in the META section is states UTF-8…)
Still no go though…
I found out how to set the charset in perl:
print "Content-Type: text/html; charset=utf-8nn";
I will have to consult a perl pro to get this into the script and see if that works.
Thanks for your help Otto and Moshu.