Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-30 Thread youkidearitai
Hi, > > PSR also says that code should use spaces instead of tabs. Should PHP > stop parsing code that uses tabs instead of spaces? > > I don't think that PSR has any relevance to this conversation because > it is _too_ opinionated. Sometimes that opinion helps, and sometimes > it gets in the way

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-30 Thread Robert Landers
On Thu, Nov 30, 2023 at 1:39 AM youkidearitai wrote: > > > Many languages like Rust only support UTF-8 > > (https://doc.rust-lang.org/reference/input-format.html), and I don't > > think any new PHP developers will expect PHP to work with non-UTF8 > > encodings in the first place. > > Hi, > >

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread youkidearitai
> Many languages like Rust only support UTF-8 > (https://doc.rust-lang.org/reference/input-format.html), and I don't > think any new PHP developers will expect PHP to work with non-UTF8 > encodings in the first place. Hi, PSR-1 is required use UTF-8. https://www.php-fig.org/psr/psr-1/ Files

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread Kentaro Takeda via internals
> The migration path is to convert the legacy-encoding PHP files to UTF-8. Please take a look at the following code. This is a part of the code that I am actually maintaining in the latest version of php. ```php https://www.php.net/unsub.php

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread Claude Pache
> Le 28 nov. 2023 à 21:47, Hans Henrik Bergan a écrit : > >> What is the migration path for legacy code that use those directives? > > The migration path is to convert the legacy-encoding PHP files to UTF-8. > Luckily this can be largely automated, here is my attempt: >

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread Ayesh Karunaratne
> Shift_JIS is very ambiguous, What will we do if SJIS-2004 or SJIS-win comes? > How do we guess(detect) SJIS-2004, SJIS-win and SJIS-mac? I'm not the person you replied to in your previous email, but I thought to weigh in with what I can. My native language also uses multiple bytes, and have

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread youkidearitai
2023年11月29日(水) 21:16 youkidearitai : > > 2023年11月29日(水) 20:42 Hans Henrik Bergan : > > > > i think Shift_JIS can also be automatically converted to UTF-8, does > > this seem right? > > https://github.com/divinity76/php2utf8/commit/6e08c4c16312961170cce821195816a8d24e23f6 > > > > Sorry if it's

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread youkidearitai
2023年11月29日(水) 20:42 Hans Henrik Bergan : > > i think Shift_JIS can also be automatically converted to UTF-8, does > this seem right? > https://github.com/divinity76/php2utf8/commit/6e08c4c16312961170cce821195816a8d24e23f6 > Sorry if it's harsh, not right. Shift_JIS is very ambiguous, What will

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-29 Thread Hans Henrik Bergan
i think Shift_JIS can also be automatically converted to UTF-8, does this seem right? https://github.com/divinity76/php2utf8/commit/6e08c4c16312961170cce821195816a8d24e23f6 On Wed, 29 Nov 2023 at 01:21, youkidearitai wrote: > > > Use zend.script_encoding=sjis and zend_bultibyte=true > > > > ❯

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread youkidearitai
> Use zend.script_encoding=sjis and zend_bultibyte=true > > ❯ ~/php82/bin/php -d zend.script_encoding=sjis -d zend.multibyte=true > deprecate_zend_scriptencoding.php > array(7) { > ["biao_hex"]=> > string(6) "e8a1a8" > ["zend.multibyte"]=> > string(1) "1" > ["zend.script_encoding"]=> >

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread youkidearitai
2023年11月29日(水) 9:04 Hans Henrik Bergan : > > Do you have access to a project actually using Shift_JIS? Interesting! > I thought they were practically unicorns / non-existent running PHP4, > > Can you run > ``` > var_dump(array( > "biao_hex" => bin2hex("表"), > "zend.multibyte" =>

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
actually scratch that, run ``` var_dump(array( "biao_hex" => bin2hex("表"), "zend.multibyte" => ini_get("zend.multibyte"), "zend.script_encoding" => ini_get("zend.script_encoding"), "zend.detect_unicode" => ini_get("zend.detect_unicode"), "mbstring.internal_encoding" =>

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
Do you have access to a project actually using Shift_JIS? Interesting! I thought they were practically unicorns / non-existent running PHP4, Can you run ``` var_dump(array( "biao_hex" => bin2hex("表"), "zend.multibyte" => ini_get("zend.multibyte"), "zend.script_encoding" =>

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread youkidearitai
2023年11月29日(水) 8:07 Hans Henrik Bergan : > > @youkidearitai right now the code specifically deals with > - UTF8: removing UTF8 BOM and removing `declare(encoding='UTF-8'); > - UTF16LE/UTF16BE/UTF32LE/UTF32BE: converting to UTF8 removing the BOM > and removing declare(encoding='...') > -

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
@youkidearitai right now the code specifically deals with - UTF8: removing UTF8 BOM and removing `declare(encoding='UTF-8'); - UTF16LE/UTF16BE/UTF32LE/UTF32BE: converting to UTF8 removing the BOM and removing declare(encoding='...') - ISO-8859-1: converting to UTF-8 and removing

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread youkidearitai
2023年11月29日(水) 7:41 Hans Henrik Bergan : > > btw if we come to some consensus to my php2utf8.php script is actually > worthwhile to expand on, i can volunteer to add more encodings (SJIS, > BIG5, anything supported by mbstring), > but it wouldn't surprise me if a better approach exist and the

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Mark Trapp
On Tue, Nov 28, 2023 at 12:48 PM Hans Henrik Bergan wrote: > >If the solution is as easy as just converting the encoding of the > source file, then why did we even need to have this setting at all? > Why did PHP parser support encodings that demanded the introduction of > > I've read your

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
btw if we come to some consensus to my php2utf8.php script is actually worthwhile to expand on, i can volunteer to add more encodings (SJIS, BIG5, anything supported by mbstring), but it wouldn't surprise me if a better approach exist and the script should be rewritten entirely~ >add that what's

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
> What is the migration path for legacy code that use those directives? The migration path is to convert the legacy-encoding PHP files to UTF-8. Luckily this can be largely automated, here is my attempt: https://github.com/divinity76/php2utf8/blob/main/src/php2utf8.php but that code definitely

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Claude Pache
> Le 28 nov. 2023 à 20:56, Kamil Tekiela a écrit : > >> Convert your PHP source files to UTF-8. > > If the solution is as easy as just converting the encoding of the > source file, then why did we even need to have this setting at all? > Why did PHP parser support encodings that demanded the

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Kamil Tekiela
> Convert your PHP source files to UTF-8. If the solution is as easy as just converting the encoding of the source file, then why did we even need to have this setting at all? Why did PHP parser support encodings that demanded the introduction of this declare? -- PHP Internals - PHP Runtime

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Dusk
On Nov 28, 2023, at 11:12, Claude Pache wrote: > Le 28 nov. 2023 à 19:57, Hans Henrik Bergan a écrit : >> With the dominance of UTF-8 (a fixed-endian encoding), surely no new >> code should utilize any of declare(encoding='...') / zend.multibyte / >> zend.script_encoding / zend.detect_unicode.

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Kamil Tekiela
Hi Hans, Can you share a little more details about how this works? This is a pretty niche functionality, so most people probably don't know what it is, how it works, or why it should no longer be used. Also, as Claude mentioned, what is the preferred alternative? Regards, Kamil -- PHP

Re: [PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Claude Pache
> Le 28 nov. 2023 à 19:57, Hans Henrik Bergan a écrit : > > With the dominance of UTF-8 (a fixed-endian encoding), surely no new > code should utilize any of declare(encoding='...') / zend.multibyte / > zend.script_encoding / zend.detect_unicode. > I propose we deprecate all 4. Hi, What is

[PHP-DEV] Deprecate declare(encoding='...') + zend.multibyte + zend.script_encoding + zend.detect_unicode ?

2023-11-28 Thread Hans Henrik Bergan
With the dominance of UTF-8 (a fixed-endian encoding), surely no new code should utilize any of declare(encoding='...') / zend.multibyte / zend.script_encoding / zend.detect_unicode. I propose we deprecate all 4. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: