Re: Mb_output_handler and Shift-JIS
| From: | moriyoshi at at dot wakwak dot com | Date: | Sun, 05 Jan 2003 02:30:54 +0000 |
| Subject: | Re: Mb_output_handler and Shift-JIS | ||
| References: | 1 2 3 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-384@lists.php.net to get a copy of this message | ||
Hi,
On Sun, Jan 05, 2003 at 12:20:51AM -0000, David Powers wrote:
> 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
I see no problem in this.
> > 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?
Nope. Both on Windows and *nix machines you can compose arbitrary Japanese
texts in Shift_JIS, EUC-JP, UTF-8, ISO-2022-JP, or UTF-8 with appropriate
editors, which you can find at numerous sites out there. Mere part of
them are listed in the following page. (Good luck!)
http://dir.yahoo.co.jp/Computers_and_Internet/Software
> Since most PCs in Japan also work in Shift_JIS, this must be a common
> configuration, which is why I'm so confused.
*Most* PC's should work with Shift_JIS as long as the software installed in
them are properly designed to cope with that charset(encoding).
But, I'm afraid that PHP binaries that come up with basic compile-time
configuration (most RPMs, DEBs, and Windows binaries distributed at the
official sites AFAIK) don't support Shift_JIS encoded scripts and pages.
If you are allowed to build and install your own php binary in the remote
computer, then try specifying --enable-zend-multibyte in configure parameters,
and setting both mbstring.script_encoding and mbstring.internal_encoding to
Shift_JIS.
> 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?
No significant changes have been made between these versions. All that
the mbstring developers did is bug fixing.
And I can't tell which database application is better at Japanese text
handling. I mean it's just up to your preference.
Moriyoshi