# Character lost while convert from cp936 to utf-8 using mb_convert_encoding

- Thread: https://externals.io/message/56382
- Original archive: https://news-web.php.net/php.internals/56382
- Started by Laruence on 2011-11-18T05:09:48+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #56382 — Laruence — 2011-11-18T05:09:48+00:00

URL: https://externals.io/message/56382#56382

Hi:

   I have filed a bug about this issue: https://bugs.php.net/bug.php?id=60306

   following script:

<?
$s = "洪仁";
var_dump(mb_convert_encoding($s, "utf8", "gbk"));

var_dump(iconv("gbk", "utf8", $s));
?>

save the script in fenc=cp936

then, run the script in php5.4 , output is :

string(3) "洪"
string(6) "洪仁"

characters lost while converting from cp936 to utf8. this is really a big
problem.....


thanks
-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #56384 — Laruence — 2011-11-18T05:22:44+00:00

URL: https://externals.io/message/56382#56384 · In reply to: #56382

Hi:

at least , this is a really big problem for chinese phpers :)

thanks


> Hi:
>
>   I have filed a bug about this issue: https://bugs.php.net/bug.php?id=60306
>
>   following script:
>
> <?
> $s = "洪仁";
> var_dump(mb_convert_encoding($s, "utf8", "gbk"));
>
> var_dump(iconv("gbk", "utf8", $s));
> ?>
>
> save the script in fenc=cp936
>
> then, run the script in php5.4 , output is :
>
> string(3) "洪"
> string(6) "洪仁"
>
> characters lost while converting from cp936 to utf8. this is really a big
> problem.....
>
>
> thanks
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #56385 — Laruence — 2011-11-18T08:52:21+00:00

URL: https://externals.io/message/56382#56385 · In reply to: #56382

Hi:

   I have fixed the bug(it is a simple fix that I didn't expect before
I look into it ),  ignore me...

thanks


> Hi:
>
>   I have filed a bug about this issue: https://bugs.php.net/bug.php?id=60306
>
>   following script:
>
> <?
> $s = "洪仁";
> var_dump(mb_convert_encoding($s, "utf8", "gbk"));
>
> var_dump(iconv("gbk", "utf8", $s));
> ?>
>
> save the script in fenc=cp936
>
> then, run the script in php5.4 , output is :
>
> string(3) "洪"
> string(6) "洪仁"
>
> characters lost while converting from cp936 to utf8. this is really a big
> problem.....
>
>
> thanks
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/
>



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #56386 — Alexey Shein — 2011-11-18T09:03:45+00:00

URL: https://externals.io/message/56382#56386 · In reply to: #56385

Well done! :)
2011/11/18 Laruence <laruence@php.net>:
> Hi:
>
>   I have fixed the bug(it is a simple fix that I didn't expect before
> I look into it ),  ignore me...
>
> thanks
>
> 
> > […]
>
>
>
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/
>
> --
> 
> 
>
>



-- 
Regards,
Shein Alexey
