Thaana conversions class for PHP 5 - v0.2

Here is an update to the Thaana conversions class I released in Nov 2007. This new version 0.2 release expands the varieties of conversions available and should be more than adequate for almost all uses. This version, most importantly, adds solid UTF-8 conversion functions allowing for more flexibility in PHP-based Unicode/UTF-8 Thaana handling. Further, the class is now licensed under the pretty liberal Open Source MIT License. The code still relies solely on core PHP 5 functions and does not demand any extra PHP extensions to be installed.

Functions exposed by the class:
- convertUtf8ToUnicodeIntegers()
Convert UTF-8 data to Unicode character integer representations

- convertUtf8ToAscii()
Convert UTF-8 data to Ascii

- convertEntitiesToUnicodeIntegers()
Convert HTML Unicode entitied string to Unicode Integer characters array

- convertEntitiesToUtf8
Convert HTML Unicode entities to UTF-8

- convertEntitiesToAscii()
Convert HTML Unicode entities to Dhivehi Ascii equivalents

- convertUnicodeIntegersToUtf8()
Convert Unicode Integer array to UTF

- convertUnicodeIntegersToEntities()
Convert Unicode char integers to HTML entities

- convertUnicodeIntegersToAscii()
Convert Unicode char integers to Ascii

- convertAsciiToUtf8()
Convert Ascii Thaana to UTf-8

- convertAsciiToUnicodeEntities()
Convert Ascii Thaana to Unicode HTML entities

- convertAsciiToUnicodeIntegers()
Convert Ascii Thaana to an array of Unicode integers

Usage:
<?php
$thaana 
= new Thaana_Conversions();
echo 
$thaana->convertEntitiesToAscii('&#1931;&#1960;&#1928;&#1964;&#1920;&#1960;');
echo 
$thaana->convertAsciiToUtf8('rWacje');
?>

Download:
- Thaana_Conversions.zip (v0.2, 3KB)

Drop me a line if you run into trouble with any of the functionality or have comments/queries. Enjoy :-)

Trackbacks

  1. Firefox 3 Thaana display bug: review and fixes

    Maldivians who use Firefox would be aware that certain Dhivehi websites, such as Miadhu Online, no longer display the Thaana fonts correctly when they switched to the recently released version 3 of the popular browser. I would like to review the issue for

Comments

Display comments as (Linear | Threaded)

  1. ajaaibu says:

    Wow. Now we can play with thaana like a football eh. man u are developing a great class.. I've used the earlier release on my last project. work got much easier. Thank you dude

  2. Nattu says:

    Big help doode. Loved the last one.. and good to know abt the flexibility in PHP.
    Can't wait to try out :-)...

    Thanks & Good work..

  3. jaa says:

    Thanks ajaaibu and nattu :-)

  4. flashpixel says:

    but storing this way in unicode means eating more space then in thaana! is there any fix for this?! or hw can we use pack fnction if its possible?!

  5. Jaa says:

    You really shouldn't be worried about the storage increase that much. Modern webhosting services offer more than enough to compensate for it. And, using compression is not advised as it will hamper search and indexing functions...

    If you really want to keep things the way it is, you can simply convert the output text to Unicode on-the-fly before serving the page to clients. :-)

  6. ahmed says:

    hey, when I convert the output, the html tags are also converted. < p > becomes < ޕ >.. please help...


Add Comment


Standard emoticons like :-) and ;-) are converted to images.