From 721f7b81a4e696a4110e7b956637dc37a1cec6f1 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Wed, 5 Oct 2005 11:30:09 +0000 Subject: [PATCH] Only UTF-8 and ISO-8859-1 can be encoded by PHP. --- .../serendipity_event_spartacus.php | 12 +++++++++++- .../serendipity_event_xhtmlcleanup.php | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php index ae03c43..945fced 100644 --- a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php +++ b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php @@ -415,7 +415,17 @@ class serendipity_event_spartacus extends serendipity_event foreach($xml_matches[0] as $xml_index => $xml_package) { $i = 0; - $p = xml_parser_create($encoding); + + switch(strtolower($encoding)) { + case 'iso-8859-1': + case 'utf-8': + $p = xml_parser_create($encoding); + break; + + default: + $p = xml_parser_create(''); + } + xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); @xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, LANG_CHARSET); $xml_package = $xml_string . "\n" . $xml_package; diff --git a/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php b/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php index 81620a1..15c75e6 100644 --- a/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php +++ b/plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php @@ -189,7 +189,16 @@ class serendipity_event_xhtmlcleanup extends serendipity_event $val = &$this->cleanup_val; // Instead of nasty regex-mangling we use the XML parser to get the attribute list of our input tag - $p = xml_parser_create(LANG_CHARSET); + switch(strtolower(LANG_CHARSET)) { + case 'iso-8859-1': + case 'utf-8': + $p = xml_parser_create(LANG_CHARSET); + break; + + default: + $p = xml_parser_create(''); + } + @xml_parse_into_struct($p, $data[0], $vals, $index); xml_parser_free($p); -- 2.39.5