PHP Classes

Arabic text problem

Recommend this page to a friend!

      RSS Writer class  >  All threads  >  Arabic text problem  >  (Un) Subscribe thread alerts  
Subject:Arabic text problem
Summary:Arabic text does not displayed properly
Messages:11
Author:Said Bakr
Date:2007-09-12 22:01:34
Update:2008-10-20 03:56:41
 
  1 - 10   11 - 11  

  1. Arabic text problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2007-09-12 22:01:34
Hi,

I tried to enter Arabic text as items description and changing the encoding into UTF-8 and windows-1256 (in the XSL file and rss_example.php) but every time encoding looks incorrect and text is unreadable. I have got a look into the generated "rss_example.php" source from the browser (I.E 7) and I found that the Arabic text inside the source is incorrect too.

Is this a bug?!

Best Regards,
Said Bakr.

  2. Re: Arabic text problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-13 01:54:33 - In reply to message 1 from Said Bakr
Are you passing feed data to the class in the same encoding as the inputencoding class variable?

  3. Re: Arabic text problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2007-09-14 00:20:55 - In reply to message 2 from Manuel Lemos
Well! I may not able, exactly, understand what do you mean, However, the following is some copy and paste of "rss_example.php" that I used it:-

$properties['description']='الذي لا يضام وارحمني بقدرتك علي حتى لا اهلك أنت رجائي فكم من نعمه أنعمت بها علي قل لك عندها شكري وكم من بلية ابتليتني بها قل لك عندها ';
$properties['link']='http://www.phpclasses.org/reviews/latest/latest.xml';
$properties['title']='New Said Bakr';
$properties['dc:date']='2002-05-06T00:00:00Z';
$rss_writer_object->additem($properties);
------------------

if($rss_writer_object->writerss($output))
{

/*
* If the document was generated successfully, you may now output it.
*/
Header('Content-Type: text/xml; charset="'.'UTF-8'.'"');
Header('Content-Length: '.strval(strlen($output)));
echo $output;
}
-------------------------------------------------

As I mentioned above, I changed the encoding values in rss1html.xsl file. By the way, the Arabic text displayed in this reply is incorrect inspite of it displayed correctly inside the "Winsyntax" the text editor that I used.

  4. Re: Arabic text problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-14 18:09:36 - In reply to message 3 from Said Bakr
The class can only output feeds in UTF-8, if the input encoding is ISO-8859-1 or is already in UTF-8.

If you to want pass feed values in other encoding besides ISO-8859-1 or UTF-8, you need to set the both inputencoding and outputencoding variables to whatever character set you use.

  5. Re: Arabic text problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2007-09-15 02:38:16 - In reply to message 4 from Manuel Lemos
Hi,

My operating system is Windows XP and the regional settings is set to Arabic.

I just edited the "rss_example.php" file enclosed with the class package using a text editor. The edit process was about to replace the English text in both title and description properties with Arabic text. I can read the text well inside the text editor, but when I call the "rss_example.php" the output text is not correct. Is it possible to be related with my local Apache server? Really, I don't know! Due to this website pages encoding is ISO-8859-1 so the following Arabic text will not displayed correctly!
إختبار لغة عربية

To test what I mean, you may able to visit any Arabic website that use UTF-8 encoding such as http://www.ashrafmisr.com and copy a piece of text and place it inside the example file then compare the result with the original text.

Best Regards.

  6. Re: Arabic text problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-15 03:38:22 - In reply to message 5 from Said Bakr
If you add RSS feed text encoded in UTF-8, you need to set the inputencoding class variable to 'utf-8' .

  7. Re: Arabic text problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2007-09-15 16:53:31 - In reply to message 6 from Manuel Lemos
Thank you Manuel,

I have set the classes's property member "inputencoding" to "utf-8" and then everything gone well.

It seems that character encoding value is case sensitive. i.e when set it as "UTF-8" it does not work properly.

Thank you again and soon I will supply you with a website that use your class to generate its RSS feed.

Best Regards,
Said Bakr

  8. Re: Arabic text problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-09-17 21:22:02 - In reply to message 7 from Said Bakr
Yes, there was a bug in the XML writer class that was not allowing input and output encodings to be considered case insensitive.

I just fixed the bug and uploaded the fixed version. Thank you for reporting.

  9. Re: Arabic text problem   Reply   Report abuse  
Picture of Hani Draye Hani Draye - 2008-10-18 06:30:09 - In reply to message 6 from Manuel Lemos
Hi
Is there a way to show utf8 feeds on windows-1256 sites and vise versa?

and How please

regards

Hani

  10. Re: Arabic text problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-10-20 03:06:20 - In reply to message 9 from Hani Draye
You can use any encoding you like for the RSS feeds as long as the input and output encoding are the same.

The class only supports utf-8 and iso-8859-1 when the input and output encoding are different.

 
  1 - 10   11 - 11