Reputation: 125
What is the usage of "mbstring.script_encoding" config? Is it diffrent from mbstring.internal_encoding?
http://php.net/manual/en/mbstring.configuration.php
Upvotes: 1
Views: 1302
Reputation: 627
It is zend.script_encoding
now. Let me show you an example.
I have a script written in CP1251.
// script encoded as ANSI. var_dump() says false
var_dump(mb_check_encoding('Кириллица', 'UTF-8'));
$input = $_GET['internalInput'];
var_dump(mb_check_encoding($input, 'UTF-8'));
In my INIes I already have the config:
mbstring.encoding_translation = On
mbstring.internal_encoding = UTF-8
bool(false)
bool(true)
Where $input
is a Cyrillic string %D0%F3%F1%F1%EA%E8%E9
.
Now let us change configuration for script encoding. In php.ini
(or in another INIes. It depends on your sys config) you can find lines like
; If enabled, scripts may be written in encodings that are incompatible with
; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such
; encodings. To use this feature, mbstring extension must be enabled.
; Default: Off
zend.multibyte = On
; Allows to set the default encoding for the scripts. This value will be used
; unless "declare(encoding=...)" directive appears at the top of the script.
; Only affects if zend.multibyte is set.
; Default: ""
zend.script_encoding = CP1251
By default all these lines are commented. Here I set multibyte
to On
and script encoding to CP1251
. Do a test again.
bool(true)
bool(true)
So... we just easily migrated to UTF-8 :)
Upvotes: 1