Re: Problem with Shift_JIS script encoding

Lew Mark-Andrews <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <v04003a01bd267ca4ccc2@[192.168.1.101]>
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

-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.