Re: Re: ampersand in dom with utf-8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jonathan wrote:
So I'm reading up on character encoding in XML documents as I think this is the problem (after the many helpful suggestions on this list).

With regards to your second question; no, I'm not sure if I'm using proper utf-8 througout the entire process. When I input from the form I'm converting everything via htmlentities . This is why I'm getting è etc... (On a side note, is there a function or way to check to see if a form is using the native characters (from a copy and paste of a word document like è) or the HTML entity è .

If you're using the correct character set all the way through, you only need to do htmlspecialchars() to convert things like & and <, as all the other characters should already be present in the character set you are using (UTF-8). htmlentities() is mostly used for converting characters outside of your character set into entities.

I've changed the content-type from text/xml to application/xml but that doesn't seem to help.

As only UTF-8 and UTF-16 have to be supported, I'm concerned whether the processor might think it is some other encoding.

The HTTP headers are:

Date => Sat, 15 Oct 2005 17:49:02 GMT
Server => Apache/1.3.33 (Unix) mod_jk/1.2.8 PHP/5.0.4 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a
X-Powered-By => PHP/5.0.4
Cache-Control => no-cache
Connection => close
Content-Type => application/xml

header('Content-Type: text/xml; charset=UTF-8');

I guess pursuant to cc's suggestion, I should do an html_entity_decode when I make the xml document and then do another htmlentities on the html representatoin.

Shouldn't be any need. Characters like è don't have any special meaning in XML, and they can be represented in the UTF-8 character set, so there's no need to convert them to entities at any stage.

--
Jasper Bryant-Greene
General Manager
Album Limited

a: Freepost Album, PO Box 579, Christchurch 8015, New Zealand
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
e: jasper@xxxxxxxxxxx
w: http://www.album.co.nz/

Memberships:
* Institute of Electrical and Electronics Engineers (IEEE)
* Association for Computing Machinery (ACM)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux