Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Redhat Enterprise and PHPs MBSTRING




Replying to my own previous message...

From: David E <dave@?om>
> From: Robert Fisher <robert@example.com>
> Subject: Re: [tlug] Redhat Enterprise and PHPs MBSTRING
> Date: Thu, 31 Mar 2005 19:10:17 +0900
> 
> > David E wrote:
> > >From: Robert Fisher <robert@example.com>
> > >>David E wrote:
> > >>>From: Robert Fisher <robert@example.com>
> > >>>
> > >>>>I am installing a system and for some reason we are having a problem 
> > >>>>with encoding of japanese text to be sent out in emails.  The emails 
> > >>>>either come in "mojibake" or cutoff.  
> > >>>Have you checked the mb-related settings in the two php.ini files, and/or
> > >>>compared the output of phpinfo() on the 2 systems?
> > >>>
> > >>Thanks for your response, yeah was the very first thing we did.  
> > >>
> > >>Would the Locale of the server have any effect?  on both servers the 
> > >>locale is english utf8.
> > >>    
> > >I'd still be inclined to look for some difference between the two
> > >systems in one of: the php code, php installation settings, php.ini settings.
> > >
> > >As in Alessandro's example, is mb_language set to "ja" in both? Are
> > >both using mb_send_mail rather than send_mail? That sort of thing. 
> > >
> > 
> > mb_language is set to "ja" on both servers. and both servers are using 
> > mb_send_mail.
> > 
> > I am actually trying to figure out why it is so different between the 
> > two servers.  We did however come up with a solution.  On the red hat 9 
> > server, we converted the body of the email to ISO-2022-JP  and the 
> > subject line was in EUC format before passing it through mb_send_mail.  
> > On the enterprise server, the solutions was to send the subject and body 
> > into mb_send_mail as EUC formatted.  I understand that mb_send_mail will 
> > convert the text to ISO-2022-JP format. 
> > 
> 
> I'd guess that passing in the subject and body in different encodings
> could cause problems with the conversion. When mb tries to detect the
> input encoding, it may just go with the first one it detects (either
> the subject or the body) and then convert everything based on
> that. 
> 
> Since you know what encoding you're starting with, why not expressly
> convert both the body and subject to ISO-2022-JP before passing them
> to mb_send_mail and avoid the risk that mb's auto-detect might get it
> wrong?

Actually, that last bit I wrote is probably wrong. mb_send_mail
probably expects the strings passed to it to be in whatever encoding
is set as the script/internal encoding (this might be clarified in the
docs or somewhere in the PHP i18n mailing list archives), and that's
why passing both in EUC works. As to why passing the body as JIS and
subject in EUC seems to work on the other system, uhhh Idunno, but I'd
try changing it (to EUC, EUC) on that system too, to see if it works
consinstently.

-dave


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links