3

I am developing a PHP Application that needs to display and accept content written in tamil. For example "login" should be written in tamil on the form.

How can I achieve this ?

1

2 Answers 2

8

If you want to display tamil characters on a web page, be it in PHP or any other web technology, you have to indicate to the browser that the page is written in UTF-8.

Also, "how to create web sites in indian languages?" might help you as it gives why and how you have to do it.

In short:

  1. Make sure to save your PHP file in UTF-8.
  2. Indicate to the browser that the page should be viewed in UTF-8 by adding the following meta to the page: <meta http-equiv=Content-Type content="text/html; charset=utf-8">
  3. You have to configure your web application to serve UTF-8 content. As such, The HTTP Content-Type header should look like so: Content-Type: text/html; charset=utf-8

I'm not a PHP programmer at all, but you should check out How to display unicode data in PHP, this should help you a lot.

3
  • 3
    To put it more generally - any encoding that encodes a character set that contains the characters to be used. For tamil UTF-8/16/32 or TSCII. UTF-8 is the most practical of course.
    – Esailija
    Mar 27, 2013 at 19:08
  • very good point!
    – Jalayn
    Mar 27, 2013 at 19:13
  • 1
    Great answer. Also, your database must be set up to use UTF-8. Some details that may help: glenpeterson.blogspot.com/search/label/UTF-8 May 15, 2013 at 12:58
2

Save the files in UTF-8 if using a editor like Editplus or eclipse you can google how to

Use a multipart form with UTF encoding https://stackoverflow.com/questions/1075513/php-parsing-multipart-form-data

In your persistance / data base layer set up the tables to accept UTF-8 and your good to go. If using My SQL its usually on by default for varchar

2
  • 1
    oh yeah : Content-Type: text/html; charset=utf-8 is very important.
    – tgkprog
    Mar 27, 2013 at 20:31
  • * we had to save all files includes etc in UTF-8 too.
    – tgkprog
    Mar 27, 2013 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.