• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Thailanguage with php mysql

when I read the data from my sql in Thai language it show like this ทดสอบภาไทย
How can i solve this problem
1 Solution

Try this:
Set your web page charset encode to charset=utf-8 (unicode) like this:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="Content-Type" content="text/html; charset=tis-620">

Could you give more infromation, which mysql-server are you using, which php-version and which phpgroupware-version.
Is the correct code-page generated by phpgroupware for that page. Is your browser capable of displaying those characters?

Have you opend a bug-report at:
Well, in some way it seems that you execute some htmlspecialchars or htmlentities on the original string.

This could be pre-db-insertion or post-db-select, e.g. done before you submit data into the database, or after reading from the database.

It would be most welcome if you where able to check what's inside the actual database (using phpmyadmin or another tool.)
If the thai is htmlentities'd before inserting into the database this requires a whole other solution then when it is not.


Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

teeraAuthor Commented:
I check on thai word that I type when it go to mysql database it change to  
I think it is like that in the Database is because, the DB need to store Raw data and not encoded data.
Even if it stores the Thai characters like #3607;&#3604;&#3626;&#3629;&#3610;&#3616;&#3634;&#3652;&#3607;&#3618 when you extract them from the database and display them on the web page it should display the proper thai characters.
Bernard S.Commented:
You need to be sure that all the whole chain is utf8.
That is:
1 - your php page being itself utf_8 encoded;
2 - this php page generates an html header described by minichicken in the FIRST lines of your html code
3 - when getting data from a db, you do the proper encoding to output text in utf-8
4 - when looking at the page with your browser this is using the code you have selected in the steps above.

Point 4: if you are using IE, "Dsplay" / "Code"  [Sorry, not sure this is the exact wording in English] and the check which code is currently active. Try to change it for UTF-8: is your page looking better?
Also look at the page source code: where is the line with "charset"? is it in the first lines?

Point 3: use phpMyAdmin to look at your data. you'll need to have the propre code setting in the right most frame. then check what you see.
If you find the &#3607;&# things, then that means that these characters are in the base (ie, &, #, 3, 6, 0, 7...)
All is not lost... use the mulitbyte strings functions http://www.php.net/mbstring to convert your "iso-type" of string to utf-8.
In some occasions, you'll need to do the reverse... so some trial and error seems required.

I have tested displaying your codes in my own browser, they display fine  B-)) well they look like thai charcaters but I am not an expert...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now