Hi Moriyoshi:
plz sync this fix into libmbfl :)
thanks
On Fri, Nov 18, 2011 at 4:50 PM, Xinchen Hui <[email protected]> wrote:
> laruence Fri, 18 Nov 2011 08:50:29 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=319452
>
> Log:
> Fixed bug #60306 (Characters lost while converting from cp936 to utf8)
>
> Bug: https://bugs.php.net/60306 (Assigned) Characters lost while converting
> from cp936 to utf8
>
> Changed paths:
> U php/php-src/branches/PHP_5_4/NEWS
> U
> php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> A php/php-src/branches/PHP_5_4/ext/mbstring/tests/bug60306.phpt
> U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> A php/php-src/trunk/ext/mbstring/tests/bug60306.phpt
>
> Modified: php/php-src/branches/PHP_5_4/NEWS
> ===================================================================
> --- php/php-src/branches/PHP_5_4/NEWS 2011-11-18 08:30:04 UTC (rev 319451)
> +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-18 08:50:29 UTC (rev 319452)
> @@ -35,6 +35,10 @@
> . Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference).
> (Maksymilian Arciemowicz, Felipe)
>
> +- Mbstring
> + . Fixed bug #60306 (Characters lost while converting from cp936 to utf8).
> + (Laruence)
> +
> -CLI SAPI:
> . Fixed bug #60159 (Router returns false, but POST is not passed to
> requested
> resource). (Laruence)
>
> Modified:
> php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> ===================================================================
> ---
> php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> 2011-11-18 08:30:04 UTC (rev 319451)
> +++
> php/php-src/branches/PHP_5_4/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> 2011-11-18 08:50:29 UTC (rev 319452)
> @@ -103,7 +103,7 @@
> mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter)
> {
> int k;
> - int c1, c2, w;
> + int c1, c2, w = -1;
>
> switch (filter->status) {
> case 0:
> @@ -304,5 +304,3 @@
>
> return c;
> }
> -
> -
>
> Added: php/php-src/branches/PHP_5_4/ext/mbstring/tests/bug60306.phpt
> ===================================================================
> --- php/php-src/branches/PHP_5_4/ext/mbstring/tests/bug60306.phpt
> (rev 0)
> +++ php/php-src/branches/PHP_5_4/ext/mbstring/tests/bug60306.phpt
> 2011-11-18 08:50:29 UTC (rev 319452)
> @@ -0,0 +1,11 @@
> +--TEST--
> +Bug #60306 (Characters lost while converting from cp936 to utf8)
> +--SKIPIF--
> +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
> +--FILE--
> +<?php
> +$s = "洪仁玕";
> +var_dump($s === mb_convert_encoding(mb_convert_encoding($s, "cp936",
> "utf8"), "utf8", "cp936"));
> +?>
> +--EXPECT--
> +bool(true)
>
> Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> ===================================================================
> --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> 2011-11-18 08:30:04 UTC (rev 319451)
> +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_cp936.c
> 2011-11-18 08:50:29 UTC (rev 319452)
> @@ -103,7 +103,7 @@
> mbfl_filt_conv_cp936_wchar(int c, mbfl_convert_filter *filter)
> {
> int k;
> - int c1, c2, w;
> + int c1, c2, w = -1;
>
> switch (filter->status) {
> case 0:
> @@ -304,5 +304,3 @@
>
> return c;
> }
> -
> -
>
> Added: php/php-src/trunk/ext/mbstring/tests/bug60306.phpt
> ===================================================================
> --- php/php-src/trunk/ext/mbstring/tests/bug60306.phpt
> (rev 0)
> +++ php/php-src/trunk/ext/mbstring/tests/bug60306.phpt 2011-11-18 08:50:29
> UTC (rev 319452)
> @@ -0,0 +1,11 @@
> +--TEST--
> +Bug #60306 (Characters lost while converting from cp936 to utf8)
> +--SKIPIF--
> +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
> +--FILE--
> +<?php
> +$s = "洪仁玕";
> +var_dump($s === mb_convert_encoding(mb_convert_encoding($s, "cp936",
> "utf8"), "utf8", "cp936"));
> +?>
> +--EXPECT--
> +bool(true)
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Laruence Xinchen Hui
http://www.laruence.com/
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php