utf-8 characters delivered as question marks involuntary
[email protected] (Nash Nipples) Fri, 12 Sep 2008 05:53:53 -0700 (PDT)
| Newsgroups | php.i18n |
|---|---|
| Message-ID | <[email protected]> |
Dear listmates,
Please, let me start with an illustration to cut it short:
input => output
A: 3313 => 3313;
B: 3313 => 3?13;
-------------------------
3 -> a variable-length character;
1 -> a one byte ascii character;
? -> a one byte ascii question mark (literaly)
That means when i output a constant (a string of variable-length characters) with an echo() function i normally get everything correct in a browser window. That makes a case A
Sometimes (probability 1/(2-20)) i get a question mark instead of a particular variable-length character when the other variable-length characters are displayed correctly within the same page. This is case B
Can someone please tell me what could be the cause of that.
Personally i can imagine
anything from a faulty hardware from the memory down the nic to a software error anywhere but the drivers. And i would rather like to narrow the scope.
Thanks
Nash
More details for an instant:
- Only characters read from a utf-8 encoded file with a function file_get_contents() seem to be displayed correctly at all times;
- Characters that are read by the php.exe (please excuse me here) do fail once in a while
- Interesting observation is that in case of a failure 'mbstring.internal_encoding' constant output by the phpinfo() changes from undefined to ISO
- Even more interesting observation is that changing this 'mbstring.internal_encoding' and setting it to UTF-8 locally does not affect things to the better.
A glimpse of the php settings:
mb_internal_encoding("UTF-8");
ini_set('mbstring.internal_encoding',
'UTF-8');
ini_set('iconv.input_encoding', 'UTF-8');
ini_set('iconv.internal_encoding', 'UTF-8');
ini_set('iconv.output_encoding', 'UTF-8');
ini_set('default_charset', 'UTF-8');
ini_set('detect_unicode', 'Off');
ini_set('display_startup_errors', 'On');
ini_set('output_buffering', 'On');
ini_set('zlib.output_compression', 'Off');