On Oct 22, 2012, at 1:39 PM, Razvan Cojocaru <[email protected]> wrote:

>> Problema este ca in php5.3.3 (debian lenny), functia xml_parse_into_struct 
>> esueaza cu return code 0, fara a da nici o eroare, si evident fara a-si face 
>> treaba.
> 
> In caz ca am fost prea laconic inainte, de la al doilea link aflam:
> 
> "Also, I tested before and after xml_parser_free() -- as expected, the
> error is indeed cleared with the free() so check your error before
> calling xml_parser_free()"


Mersi, ne apropiem:

xml_parse_into_struct($parser, stripslashes($string), $vals, $index);
echo xml_error_string(xml_get_error_code ($parser));

zice: "Invalid encoding"

Insa am acelasi rezultat setat secvential toate cele 3 optiuni mentionate la 
http://www.php.net/manual/en/function.xml-parser-set-option.php

xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'ISO-8859-1');
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'US-ASCII');

Daca pun stringul intr-un fisier, file imi zice:

$ file /tmp/aaa 
/tmp/aaa: UTF-8 Unicode text, with very long lines, with no line terminators


_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui