Req #74777 [NEW]: automatically convert all strings given in php script file
| From: | qdinar at gmail dot com | Date: | Sun, 18 Jun 2017 16:26:46 +0000 |
| Subject: | Req #74777 [NEW]: automatically convert all strings given in php script file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209579@lists.php.net to get a copy of this message | ||
From: qdinar at gmail dot com
Operating system: windows 10
PHP version: 5.6.30
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:automatically convert all strings given in php script file
Description:
------------
i use one-byte encoding for script's calculations, and want to provide
one-byte strings, but i want to write php code itself in utf-8 because i
use non-windows-1251 characters in comments.
i have tried "declare(encoding='utf-8');" for that but seems it does not
work that way, see example below.
i tried that because it is written at
http://php.net/manual/en/ini.core.php#ini.zend.script-encoding
:
" Literal strings will be transliterated from zend.script_enconding to
mbstring.internal_encoding, as if mb_convert_encoding() would have been
called. "
and i thought that maybe " declare(encoding='utf-8'); " sets same
"zend.script_enconding" but just for a separate file. (they are somehow
related, as i have seen from docs). i do not want to have set it to all
files.
Test script:
---------------
php script file in utf-8 encoding:
<?php
declare(encoding='utf-8');
mb_internal_encoding('windows-1251');
file_put_contents( 'declare_encoding.txt' , "ÑÑлÑм");
?>
Expected result:
----------------
"ÑÑлÑм" written with windows-1251
Actual result:
--------------
"ÑÑлÑм" written with utf-8
--
Edit bug report at https://bugs.php.net/bug.php?id=74777&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74777&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74777&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74777&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74777&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74777&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74777&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74777&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74777&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74777&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74777&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74777&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74777&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74777&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74777&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74777&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74777&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74777&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74777&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74777&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74777&r=mysqlcfg