I have a website, and need to store data from a text field into a mysql database.
The frontend is perl. I used utf8::encode
to encode the data into utf8.
The request is made to the Java backend which connects to the mysql db and inserts this text. For the table the default charset is set to utf8. This works in many cases, but it fails in some cases.
If I use テスト
, the data stored in the database shows questions marks: ã??ã?¹ã??
.
If I try to insert the utf8 encoded string directly from the sql browser, everything works fine.
Update events set summary = ãã¹ã
where event_id = 11657
;
While inserting I noticed there are some blank characters that show up in the mysql query browser, something like: ã ã¹ ã
.
After inserting from here, data in the database shows some boxes in the database instead of these spaces, and テスト
displays correctly on the website after utf8 decoding it.
The problem is only when I insert directly from the website, these special characters come up as question marks in the database.
Can someone please help me with these special characters? Do I need to handle them differently?
String.getBytes()
(without an encoding argument). Another possibility is encoding issues in communicating the web page. – Ted Hopp