Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-03 kl. 11.18 skrev Victor Spng Arthursson: Temporarely solved the problem using substring to trim the crap-chars away, but I'ld prefer to solve it in a more beautiful way, but perhaps this behaviour is a bug and therefore not possible to solve in any other way But do we think it works when uploaded to the production server? No It runs php on Wintendo though, but shouldn't make any difference - should it? 2 days just to apply a xsl-stylesheet on a xml file!? :( If anyone successfully has succeeded doing this, please give me some hints. Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
Here is the error message, that the code produces: http://tosti.dk/xml/error.php And here is a copy of the code: http://tosti.dk/xml/error.txt I really cant figure what is wrong, especially not since it works on the dev-server and the outputted xml is valid, at least as far as IE concerns Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-02 kl. 12.23 skrev Manuel Lemos: You just need to use the proper input/output encodings. Doesn't work at all The code // Prepare the content of the xml-file to go to the xsl-parser $xml = str_replace(?, chr(63), $contents); $xml = str_replace(empty/, $kurt, $xml); $xml = trim($xml); $xml = utf8_encode($xml); echo $xml; makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? And the crap in fron of the string, which seems to come from nowhere, makes the parser complain about not well formed markup in the xml-source Regards, Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-02 kl. 22.08 skrev Manuel Lemos: The code // Prepare the content of the xml-file to go to the xsl-parser $xml = str_replace(empty/, $tempxml, $xml); $xml = trim($xml); $xml = utf8_encode($xml); echo $xml; makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? And the crap in fron of the string, which seems to come from nowhere, makes the parser complain about not well formed markup in the xml-source I think it does not make any sense to do what you are doing. You should only encode XML data or attribute values. You should not encode the whole XML document. Well, I have some xml in which I want to place som new xml-data, just for the specific output, which I does by replacing an empty dummy-tag. After this, I want to send the xml to the parser. Anyway, if you try this class, you can see that it generates correct XML code in UTF or even ISO-8859-1. Well, but I don't want to download and evaluate classes, especially since they tend to be big and I just want to be able to do this with the few lines of code that should be enought Should it really be this troublesome working with XML from PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: XML, strings and foreign (swedish/danish) characters
2003-12-03 kl. 10.22 skrev Victor Spng Arthursson: makes the string ?xml version=1.0 encoding=utf-8? become ?xml version=1.0 encoding=utf-8? Temporarely solved the problem using substring to trim the crap-chars away, but I'ld prefer to solve it in a more beautiful way, but perhaps this behaviour is a bug and therefore not possible to solve in any other way Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML, strings and foreign (swedish/danish) characters
Hello, On 12/02/2003 09:05 AM, Victor spng arthursson wrote: I'm on the point of almost giving up trying to get XML and PHP to sing along, but I'll throw out a question here first. I'm having severe problems getting PHP and XML to work with XML-files that contains foreign characters. Doesnt matter if i type the foreign characters in by myself hardcoded in the PHP-script, or if I get them from external XML-files, or if I get them directly from the database. utf8_encode() helps a bit, in the way that it makes the script work at least, but instead of the string mngde PHP outputs mngde Is there any way to get XML to work together with PHP, or should I simply resign and try with ASP instead? You just need to use the proper input/output encodings. PHP function usually assume iso-8859-1 . I do not know if that is the encoding that your idiom uses. Anyway, you may want to try these XML parser and writer classes: http://www.phpclasses.org/xmlparser http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php