Re: Thai Characters display as ???
Posted by: Rick James
Date: March 14, 2011 09:04PM

There is probably not a simple answer. You may need to start over.
1. You get some bytes to put in the table.
2. You announce to the server that the bytes you have are encoded CHARACTER SET X. SET NAMES X is a simple way.
3. You declare the columns in your table to be CHARACTER SET Y. That is done with CREATE TABLE or ALTER TABLE.
4. Now, you INSERT the data.

X and Y could be tis620 or utf8 (in any combination). Note: If X and Y are different, MySQL will convert as it does the INSERT.

On the reading side, ...
1. Again, you announce what your client wants to see: SET NAMES Z. (You probably want Z and X to be the same.)
2. SELECT. Again a conversion will be done from Y to Z if they are different.
3. If you are building a web page, put the <meta ...> tag at the top to announce to the browser that the bytes are encoded Z.

I don't know if all browsers know tis620. If not, you may be better off with Z=utf8, which all browsers do know.

The problem is that there are so many moving parts, and so many settings that are virtually independent of each other.

X must reflect the encoding your incoming bytes use. The typical mistake is to ignore this step. Fiddling with Y and Z (when X is incorrect) only confuses things.

Options: ReplyQuote


Subject
Views
Written By
Posted
8336
March 11, 2011 12:04AM
2506
March 12, 2011 09:12AM
1723
March 14, 2011 08:22AM
Re: Thai Characters display as ???
2725
March 14, 2011 09:04PM
2881
March 14, 2011 11:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.