]> git.mjollnir.org Git - s9y.git/commitdiff
Only UTF-8 and ISO-8859-1 can be encoded by PHP.
authorgarvinhicking <garvinhicking>
Wed, 5 Oct 2005 11:30:09 +0000 (11:30 +0000)
committergarvinhicking <garvinhicking>
Wed, 5 Oct 2005 11:30:09 +0000 (11:30 +0000)
plugins/serendipity_event_spartacus/serendipity_event_spartacus.php
plugins/serendipity_event_xhtmlcleanup/serendipity_event_xhtmlcleanup.php

index ae03c4358d13eba8f2003f9a957b1d7e70995fef..945fced736c46160f3cce2aa9a2aeeaf6a21950f 100644 (file)
@@ -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;
index 81620a101c216da6111cb23f7b5e0e78baff30a9..15c75e65aa3a09dff0ca8e0cc10dee074b26a794 100644 (file)
@@ -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);