Re: Mb_output_handler and Shift-JIS
| From: | David Powers | Date: | Sun, 05 Jan 2003 00:20:51 +0000 |
| Subject: | Re: Mb_output_handler and Shift-JIS | ||
| References: | 1 2 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-383@lists.php.net to get a copy of this message | ||
moriyoshi@at.wakwak.com wrote:
> Hi,
>
> I might give you more information if I can see the mbstring section of
> your phpinfo().
Hi, Moriyoshi-san
Thank you for your speedy response.
This is a cut-down version of what I now have in my php.ini. As you will
see, I have commented out the output_handler line. When enabled, all I
got was mojibake.
output_buffering = On
;output_handler = mb_output_handler
default_mimetype = "text/html"
default_charset = "Shift_JIS"
[mbstring]
; language for internal character representation.
mbstring.language = Japanese
; internal/script encoding.
mbstring.internal_encoding = EUC-JP
; http input encoding.
mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = SJIS
mbstring.encoding_translation = Off
; automatic encoding detection order.
; auto means
mbstring.detect_order = auto
; substitute_character used when character cannot be converted
; one from another
mbstring.substitute_character = none;
; overload(replace) single byte functions by mbstring functions.
;mbstring.func_overload = 0
> As far as I looked at your description, I suspect that the pages are
> written in Shift_JIS charset instead of EUC-JP. In case
> mbstring.internal_encoding is set to EUC-JP and mbstring.http_output
> is set to Shift_JIS, you should write your pages in EUC-JP, as
> mbstring output handler will automatically convert the pages to
> Shift_JIS version.
This is the bit I don't understand. To the best of my knowledge, Windows
PCs create Japanese only in Shift_JIS. So how can I write pages in
EUC-JP? Or if I can't, what is the correct set-up?
Since most PCs in Japan also work in Shift_JIS, this must be a common
configuration, which is why I'm so confused.
> Note that if the page contains a meta tag like below that specifies
> in which charset the page is written, you have to make it the same as
> mbstring.http_output, not as mbstring.internal_encoding,
> since it won't automatically be adjusted by mb_output_handler.
>
> <meta http-equiv="Content-Type" content="text/html; charset=****">
My meta tag specifies charset="Shift_JIS", the same as my
mbstring.http_output. With mb_output_handler enabled, it produces
mojibake. With mb_output_handler disabled, everything is OK.
>> Is there anywhere that explains the use of mbstring in clear terms -
>> preferably in English, but I don't mind reading it in Japanese if
>> there's better material there?
>
> As one of those involved in the manual, I admit the lack of
> explanation and the obscurity of words over mbstring functionalities.
> If you find any misleading or unnatural sentences, please let us know
> so that we'd fix them quickly.
I think the real problem is the lack of basic explanation about how to
set up Japanese functionality. I will look at the PDF files you mention,
and hope they will lift some of the mystery. I see they are based on PHP
4.2.2 and PostgreSQL. Are there any major differences between 4.2.2 and
4.3.0 as far as Japanese is concerned? Also, is Postgres a better
database solution than MySQL for supporting Japanese?
David Powers