0

I've an html form receives input data from the user (name-pass-mail-phone) and when i tried to test it by inserting Arabic data , it saved it to the xml as '????' , them I added this line to my php script

header('Content-Type: text/html; charset=Windows-1256');

to handle this problem but the data was stored like 'íÇÓãíä' for the first time testing and then I kept receiving this error . Can anyone tell me what is that and how can I fix it ,plz??

Warning: simplexml_load_file() [function.simplexml-load-file]: mowasla.xml:12: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xED 0xC7 0xD3 0xE3 in D:\wamp\www\mowasla\sign.php on line 25

hakre
  • 193,403
  • 52
  • 435
  • 836
Yasmine Ra'fat
  • 97
  • 1
  • 1
  • 5
  • save page where you display data as utf-8, specify your charset as utf-8 in xml and maybe add <![CDATA[]> to your nodes – v0d1ch Feb 04 '13 at 14:08
  • which node should i add <![CDATA[]> to ?? can you show me an example plz?? – Yasmine Ra'fat Feb 04 '13 at 14:16
  • UFT-8. If you're working with anything outside the basic ASCII range, you want to be using UTF-8 encoding at all levels of your system. – SDC Feb 04 '13 at 14:17
  • my php script , xml file are both utf-8 , anything else need to be checked ? – Yasmine Ra'fat Feb 04 '13 at 14:23
  • @Yasmine - if you have some characters in xml that need to be shown exactly as they are you can add cdata to your xml nodes so that this lines are not parsed by xml parser. So if you have in xml something like this <![CDATA[íÇÓãíä]]> these character will not be parsed but displayed as they are. I think it might help your problem. Also open php file in notepad++ and make sure it is saved as utf8. check this link http://www.w3schools.com/xml/xml_cdata.asp – v0d1ch Feb 04 '13 at 14:36
  • Anything else need to be checked? Yes: your server needs to serve the page as UTF-8, and the client either needs to submit the data as UTF-8, or you need to find out how to tell what encoding the client is using in the data it's sending you, and translate the data into UTF-8. – C. M. Sperberg-McQueen Feb 04 '13 at 15:35

0 Answers0