Bug #72555 [Asn->Ver]: CLI output(japanese) on Windows
| From: | ab@php.net | Date: | Mon, 11 Jul 2016 13:14:57 +0000 |
| Subject: | Bug #72555 [Asn->Ver]: CLI output(japanese) on Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202197@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72555&edit=1
ID: 72555
Updated by: ab@php.net
Reported by: algo13 dot net at gmail dot com
Summary: CLI output(japanese) on Windows
-Status: Assigned
+Status: Verified
Type: Bug
Package: CGI/CLI related
Operating System: Windows8.1(Japanese editon)
PHP Version: Next Minor Version
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
I've investigated so far, and this seems a console issue with the particular codepage. When
using php.ini or even "-d default_charset=..." directly, it is fine. A redirection to
another program or into a file is also correct.
I currently see no API that would really affect the behavior. Seems when switching the codepage, the
console tries to remap chars to another codepage. A simple proof to this theory i made - add the
line "fscanf(STDIN, "%s", $dummy);" at the end of the reproduce code. As long as
PHP didn't switch back to UTF-8, the output looks correct.
I suspect, that a similar issue is present on other double byte codepage. With a single byte
codepage like 1252, switching codepage on runtime is of a non issue. Currently I can only recommend
to use php.ini or -d on console don't switch it, already added a note to UPGRADING. I'm
going to keep looking for a solution and keep this ticket open.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2016-07-06 17:12:09] algo13 dot net at gmail dot com
Description:
------------
echo 'æ¥æ¬èª'; (cp932) with ini_set('default_charset',
'CP932');
=> result æ¥æ¥æ¬æ¬èªèª
Test script:
---------------
C:\php-7.1.0alpha2-Win32-VC14-x64>chcp
ç¾å¨ã®ã³ã¼ã ãã¼ã¸: 932
C:\php-7.1.0alpha2-Win32-VC14-x64>type php.ini | findstr "^default_charset"
default_charset = "UTF-8"
C:\php-7.1.0alpha2-Win32-VC14-x64>type iniset.php
<?php
ini_set('default_charset', 'CP932');
echo 'æ¥æ¬èª', PHP_EOL;
/* vim:set fenc=cp932 ff=dos: */
C:\php-7.1.0alpha2-Win32-VC14-x64>php iniset.php
æ¥æ¥æ¬æ¬èªèª
C:\php-7.1.0alpha2-Win32-VC14-x64>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72555&edit=1