Re: Problem with Shift_JIS script encoding

From: Date: Fri, 23 Jul 2004 08:29:31 +0000
Subject: Re: Problem with Shift_JIS script encoding
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-735@lists.php.net to get a copy of this message
Hi, We've been round and round on this one too. >I've been having a lot of trouble since upgrading over PHP4.3.1. Here's >the problem: >1. My scripts are all written in Shift_JIS Meaning: 1) your scripts contain Japanese messages and you used Shift_JIS in your text editor, and/or 2) these scripts display in the browser with the charset explicitly set to Shift_JIS. Correct? OK. >2. When I try to send mail using the mb_send_mail function, the messages >written in >my scripts in Shift_JIS are not properly encoded (it appears that PHP >thinks that the >code is in EUC and is making an incorrect conversion). Do you really need to use EUC-JP for your application? We're also using only Shift_JIS, and successfully. More importantly I think, do you set mb_language? Try this: echo mb_language(); If it returns false, then set it to "Japanese" before sending your mail. Here's a snippet from one of our scripts: ----- mb_language("Japanese"); // <--- Add this before sending your mail. mb_send_mail ("$email_address", "$form_subject", "$message_body", "From: $form_from_name <$form_from_address>\nReply-To: <$form_reply_to>\nErrors-To: <$errors_to>"); ----- The above variables contain both user input from an online form (charset=Shift_JIS) as well as hard-coded values in the script (also in Shift_JIS). Give it a try and let us know. HTH, Lew

« previous php.i18n (#735) next »