Re: Re: Mbstring.func_overload in 4.3.0

From: Date: Tue, 07 Jan 2003 02:25:06 +0000
Subject: Re: Re: Mbstring.func_overload in 4.3.0
References: 1 2 3 4 5  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-394@lists.php.net to get a copy of this message
David Powers wrote: > Yasuo Ohgaki wrote: > >>Then you may be feeding messages with encoding other >>than internal encoding to mb_send_mail? > > > If that's the case, the question is how? For instance, you may be reading mail messages from database or text file. Encoding can be any encoding with this. > Nothing has changed in my code, except for the need to substitute mail() > for mb_send_mail(). Under 4.2.2, mb_send_mail() was needed to send > exactly the same output that now requires mail(). Which encoding results in mojibake? If you have problem ISO-8859-1, set language to 'en' before using mb_send_mail. > Here are the relevant sections of my php.ini (I am running on an English > version of Red Hat Linux 6.2 - without canna or any other Japanese > language software): > > 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 you will see, both output_handler and mbstring.func_overload are > commented out. The PHP documentation states that SJIS users should set > output_handler to mb_output_handler, but that produces mojibake. > Moreover, Moriyoshi-san commented about my php.ini on 5 January, "I see > no problem in this". This point needs clarification. If there is no > problem, why does the documentation say the exact opposite? The problem > may, of course, be with my understanding of what the documentation > means, but if that's so, I'm sure others are likely to encounter similar > difficulties. Moriyoshi should have overlooked commented out mb_output_handler. You need mb_output_handler to convert encoding from EUC-JP to SJIS. (If you really want to output SJIS) There are many cases that can result in mojibake. I suppose you have 2 problems 1. Something wrong in HTTP output. 2. Something wrong in mail message sent from mb_send_mail. For 1, check out actual encoding sent to browser. e.g. Use emacs or whatever tools that can detect encoding. Check output buffer status using ob_get_status(). For 2, set appropriate language before you send message with mb_send_mail. mb_send_mail is smart enough to encode mail message appropriately according to language setting. i.e. change language before you send mails. (We may be forgetting to document changes, but I don't have time to check it :) > > The only thing I can think of is that, during configuration, I > included --enable-mbstr-enc-trans, which I have subsquently seen is no > longer used. The compilation process produced no error messages in this > regard, so I presumed its inclusion would have caused no harm. Is this a > likely cause of the unexpected behaviour? No. It will not. --enable-mbstr-enc-trans option will not affect PHP4.3.0 or later builds. -- Yasuo Ohgaki

« previous php.i18n (#394) next »