The default national language setting (NLS) used in mbstring. Note that this option
automagically defines mbstring.internal_encoding and
mbstring.internal_encoding should be placed
after mbstring.language in php.ini

According to the » HTML 4.01 specification,
Web browsers are allowed to encode a form being submitted with a character
encoding different from the one used for the page.
See mb_http_input() to detect character encoding
used by browsers.

Although popular browsers are capable of giving a reasonably accurate guess
to the character encoding of a given HTML document, it would be better to
set the charset parameter in the
Content-Type HTTP header to the appropriate value by
header() or
default_charset ini setting.

User Contributed Notes 3 notes

The documentation is vague, on WHAT precisely the valid "NLS" language strings are that are valid for "mbstring.language".

According to http://php.net/manual/en/function.mb-language.php the values are "Japanese", "ja", "English", "en", or "uni" for UTF-8. On the other hand, the sample on this current page omits "uni" but introduces "Neutral" as an undocumented option - which is also the default value:

Adjusting the default_charset had no effect. Not even fiddling with mb_internal_encoding could fix it, simply because the strings involved had *different* encodings and without actually changing one of them they just weren't going to match.

Either re-save the source file as KOI8-R to match the data file, or re-save the data file as UTF-8 to match the source code. Only then will the script properly echo '4'.