Navigation Menu

Showing posts with label Thaana. Show all posts

How to store and retrieve Thaana Text (unicode) with PHP and MySQL?

It is inevitable for every new web developer to run in to issues either storing or retrieving Thaana Text on a MySQL database. In most cases you run in to problems like your stored text appears to be gibberish (eg: the text 'Þ‹ިÞˆެÞ€ި' appears as '??????'!). I faced the same issue and was left to boil my head for hours. So, I thought i'll make it easy for you. With just one line of code, you will be able to overcome the issue! Here I show you how to store and retrieve Thaana Text (or any other unicode text for that matter) successfully.

1. Preliminary Checkups 

A. Check if the table collation is set to "utf8_general_ci" from table operations
B. Check if the .php file is saved in utf8 encoding

These two things are VERY VERY important. Most of the times these are the two things people overlook. I personally spent many hours wondering and pondering about what I was doing wrong until I finally figured out that I saved the .php file in another encoding.

2. The Magic Line

After connecting to the MySQL database, you will need to set the character encoding to UTF8 like this in your PHP code

mysqli_query($con,"SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");

This code tells the script to do all the operations after it in UTF8 character encoding.


How to install Thaana font on your android phone/tablet

It is a simple task to install dhivehi fonts in some of these android devices which doesn't support Thaana by default.  Here I have explained two possible ways to install thaana font on almost any android device. Knock yourself out ;)

1. Manually inserting font file in to the system fonts

Credits to CryptonsYk for the video...

Requirements:
  • ROOTED phone
  • Root File Explorer
  • DroidSans.ttf font

Download Package (.zip)

On top of root explorer there will be a button called Mount R/O = read/only .. presss it and changes to R/W = read/write! Now it will allow you to paste the new font with Thaana support and over write the system font. I suggest you make a copy of the original file first, in case anything goes wrong. Replace the font file you downloaded with the existing DroidSansFallback.ttf font in the system fonts folder of your phone. You are done!!!! :)




2. Install thaana font using an android app [Root]

Now there is also an android application which claims to be able to do it for you ;)
Get the App HERE


Popular Posts

Instagram

Follow @ daniel_Ibbe