Jump to content


Photo

Character encoding problem


  • Please log in to reply
2 replies to this topic

#1 Collin

Collin
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 March 2006 - 09:42 PM

I have an xml file and all goes well when loading it, until I use "special characters" as é, è, à,... There I get the error: Input is not proper UTF-8, indicate encoding. And in the xml file I find a "?" where there should be an é, è or à.

In the xml file I have the declaration: <?xml version="1.0" encoding="ISO-8859-1"?> so what do I need to do to get these "special characters" in my xml file, if his declaration doesn't say to php "use this character set"?

I have searched for an answer, but I just don't understand what they're saying about encoding and stuff...

Help please! :-(

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 March 2006 - 09:48 PM

[!--quoteo(post=355686:date=Mar 16 2006, 09:42 PM:name=Collin)--][div class=\'quotetop\']QUOTE(Collin @ Mar 16 2006, 09:42 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I have an xml file and all goes well when loading it, until I use "special characters" as é, è, à,... There I get the error: Input is not proper UTF-8, indicate encoding. And in the xml file I find a "?" where there should be an é, è or à.

In the xml file I have the declaration: <?xml version="1.0" encoding="ISO-8859-1"?> so what do I need to do to get these "special characters" in my xml file, if his declaration doesn't say to php "use this character set"?

I have searched for an answer, but I just don't understand what they're saying about encoding and stuff...

Help please! :-(
[/quote]

These functions are enabled by default, using the bundled expat library. You can disable XML support with --disable-xml. If you compile PHP as a module for Apache 1.3.9 or later, PHP will automatically use the bundled expat library from Apache. In order you don't want to use the bundled expat library configure PHP --with-expat-dir=DIR, where DIR should point to the base installation directory of expat.

The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.


You can find a group of funtions to convert and use xml to anarray at www.php-xmla.zonapersonal.com

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Collin

Collin
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 March 2006 - 10:40 PM

I don't have access to the server, so compiling PHP in not really an option...

And I have made all the stuff to be able to edit this xml file (which holds the tree for navigation on my site), so I don't want to use this xml file as an array. I just want to be able to save these special characters in my xml file without triggering an error. I've tried some stuff with htmlentities() and utf8_decode(), but I have no idea what i'm doing, and why...

I just use the DomDocument->load() and DomDocument->save() methods, so I guess I just need to encode/decode the xml file before/after loading/saving... But I don't understand why I get an "not proper utf-8" error when I'm using an ISO character set... I've also tried setting it as an utf-8 xml file, but to no avail...

edit: I forgot to mention that I get the input for changing anything in my xml file through a form (a textbox).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users