Larry Brown wrote:
It is not that I want to generate the document in UTF-8. I just need to
specify the correct encoding. My assumption that it was UTF-8 based on
what my command line settings are is obviously incorrect. How can I
tell what php is encoding in by default?
Larry
On Fri, 2008-02-22 at 17:20 +0100, Bojan Tesanovic wrote:
encoding="UTF-8" doesn't guarantee that XML is encoded in UTF-8 its
only purpose is to tell XML parser how to decode that XML document .
it is responsibility of document creator to ensure that XML is proper
UTF-8 document .
on PHP side when creating XML there are number of functions to ensure
UTF-8 strings though there are some issues in PHP5 ,
and one of the main features of upcoming PHP6 is to address UTF-8
Issues that current PHP has.
some of UTF functions
utf8_encode — Encodes an ISO-8859-1 string to UTF-8
string utf8_encode ( string $data )
On Feb 22, 2008, at 4:52 PM, Larry Brown wrote:
I am using PHP on Linux to communicate with an XML peer. I pull and
push documents from and to their server. On the console I use
UTF-8 as
far as I can tell. When I send these documents should my leading tag
read:
<?xml versionnn="1.0" encoding="UTF-8"?>
or is the encoding done by PHP and how do I know what it is encoded
to?
TIA
Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Bojan Tesanovic
http://www.classicio.com/
http://www.real-estates-sale.com/
simple xml uses the dom api [*i think*] - the dom api only works in
utf-8 - thus your content should be utf-8 if it was created by php.
really quick way to check is to stick a £ [GBP] sign in the xml, open it
up in a browser, check the £ sign shows correctly and check the encoding
settings [firefox: view> charector encoding].
quite sure you could also
if($xml === utf8_encode(utf8_decode($xml))) {
#its utf-8
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php