Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Thailanguage with php mysql

Posted on 2004-10-30
Medium Priority
Last Modified: 2006-11-17
when I read the data from my sql in Thai language it show like this ทดสอบภาไทย
How can i solve this problem
Question by:teera
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 12

Expert Comment

ID: 12451040

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">

LVL 48

Expert Comment

ID: 12451047
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:
LVL 49

Expert Comment

ID: 12452265
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.


Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12452698
I check on thai word that I type when it go to mysql database it change to  
LVL 12

Expert Comment

ID: 12453124
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.
LVL 29

Accepted Solution

fibo earned 1400 total points
ID: 12458487
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...

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question