phpMyFAQ, arabic display problem
Posted by mkhairul - May 14, 2008 at 09:05:49 pm -Categories: Development, Tips, blog
I’ve been using phpMyFAQ for the past few days. The drawback is the unicode support (which is probably a problem for most PHP application) but everything else is ok and well designed and implemented. I have no trouble going through the code, tinkering with the inner workings and stuffs unlike KOHA (documentation very poor) which is a horror to go through. Everytime I see KOHA I would like to cry. Or maybe the version we’re currently using is horrible.
Ok, one of the other drawback is the encoding. I know there’s lots of languages that they try to support and I have come to learn very well that it is not an easy task. Recently I worked my way around trying to implement English/Arabic content for the system. Seperate CSS for each of the language (English is left to right, Arabic is right to left), to make the layout consistent.
The rest of the site displays perfectly in arabic (from the language file), but when I insert some content, it displays as html entities representation of the characters instead of the characters itself. I modified (real-time) the content a little bit by using firebug by adding a space (and removing it again), automagically it displays the arabic characters. After a refresh it is back to the entities.
Since this is the first time I’m handling unicode characters I’m not very familiar with the functions related to it. I noticed that everything that looks like it requires encoding it is passed to PMF_htmlentities, which runs it through htmlspecialchars. There’s some data inside that gets run through the function twice which ultimately results in & instead of & needed to display the html entity. Data that doesn’t display correctly I pass it through html_entity_decode which makes it display all the characters correctly.
I still don’t get it why it doesn’t display the characters correctly, the html entities printed are all correct. It just doesn’t display it correctly unless I use html_entity_decode. *shrugs*
I’d have to investigate this further in order to contribute.
References for Handling UTF-8 in PHP.
Character Sets / Character Encoding Issues
Common Problem Areas with UTF-8
How to develop multilingual, Unicode applications with PHP
Can’t wait for PHP 6, more unicode support! Yeay!
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.

