suzie Posted January 5, 2011 Share Posted January 5, 2011 Dear,through my php file, I am opening an xml file and write Arabic data to it then close it, with utf-8 encoding,but when opening the .xml file, the arabic data will not be foundhere is the code: $text_header ="<?xml version=\"1.0\" encoding=\"utf-8\"?> <?xml-stylesheet type=\"text/css\" href=\"itemcontent.css\"?> <?xml-stylesheet type=\"text/xsl\" href=\"rss2full.xsl\"?>"; $text_header1 = "<rss version=\"2.0\"> <language>ar-lb</language> <channel> <title>arabic data</title> <link>http://www.xxx.com/rss/rssMain.xml</link> <description>Lebanese Newspaper</description> <pubDate>$date</pubDate> <generator> cms</generator> <webMaster>it@xxx.com</webMaster>\n"; $text = $text_header.$text_header1. $text_main. $text_end; $filename = "../rss/rssMain.xml"; $f = fopen($filename, 'w'); if(!$f) die ("Error in opening the file \"$filename\".<BR>"); fputs($f,$text); fclose($f);*$text_main: contains arabic data,after running this code, the .xml files doesnot contain the arabic data, but if I change utf-8 to windows-1256, everything will be ok, arabic data appearsany help please Link to comment Share on other sites More sharing options...
justsomeguy Posted January 6, 2011 Share Posted January 6, 2011 Do you need to use utf8_encode to encode the text before saving it? Link to comment Share on other sites More sharing options...
suzie Posted January 7, 2011 Author Share Posted January 7, 2011 yes, I need to use utf8_encode, before saving...any help please Link to comment Share on other sites More sharing options...
boen_robot Posted January 7, 2011 Share Posted January 7, 2011 OK... if you know you need to utf8_encode() the text, do that.Alternatively, save the PHP file as UTF-8 (from notepad, click "Save As..." and select UTF-8 from the encoding dropdown) and you won't need to utf8_encode() the text. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.