]> granicus.if.org Git - php/commitdiff
- MFH: Fix bug #46843 (CP936 euro symbol is not converted properly)
authorMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 2 Feb 2009 04:53:10 +0000 (04:53 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 2 Feb 2009 04:53:10 +0000 (04:53 +0000)
ext/mbstring/libmbfl/filters/mbfilter_cp936.c
ext/mbstring/tests/bug46843.phpt [new file with mode: 0644]

index 9cdd0520e848dad77da09de94c798d5073fa3f11..561dc3003bd1e4325ee3e9e2dab5deb3835499f4 100644 (file)
@@ -192,7 +192,7 @@ mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter)
                }
        }
        if (s >= 0) {
-               if (s < 0x80) { /* latin */
+               if (s <= 0x80) {        /* latin */
                        CK((*filter->output_function)(s, filter->data));
                } else {
                        CK((*filter->output_function)((s >> 8) & 0xff, filter->data));
diff --git a/ext/mbstring/tests/bug46843.phpt b/ext/mbstring/tests/bug46843.phpt
new file mode 100644 (file)
index 0000000..136195c
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+Bug #46843 (CP936 euro symbol is not converted properly)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+var_dump(bin2hex(mb_convert_encoding("\x80", 'UCS-2BE', 'CP936')));
+var_dump(bin2hex(mb_convert_encoding("\x20\xac", 'CP936', 'UCS-2BE')));
+?>
+--EXPECT--
+string(4) "20ac"
+string(2) "80"