php-i18n Digest 30 Jul 2004 18:14:24 -0000 Issue 238
Topics (messages 735 through 740):
Re: Problem with Shift_JIS script encoding
735 by: Lew Mark-Andrews
736 by: David Emery
737 by: Anatole Varin
738 by: Lew Mark-Andrews
739 by: Moriyoshi Koizumi
es_US spanish locale doesn't recognize meridian (AM/PM)
740 by: Olga
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin 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
--- End Message ---
--- Begin Message ---
2004/07/23 (é) 16:21 ã PHPDiscuss - PHP Newsgroups and mailing lists
ãããæãããã:
> 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
> 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).
I guess PHP thinks the code is in EUC because you're telling it in the
config that it's in EUC with the following line.
;; Set internal encoding to EUC-JP
> mbstring.internal_encoding = EUC-JP
In the long run, I think you'd be better off to do your scripts in EUC,
but if you want them in SJIS then you should set the internal encoding
to SJIS. IIRC, there's also a config setting for
mbstring.script_encoding which you'd also want to set to SJIS.
There's more info on this in the docs.
Hope that helps,
-dave
>
>
>
>
>
> >From searching around online, it would appear that it is possible to
> convert the
> Shift_JIS code into EUC code by the following settings:
>
> ;; Enable Output Buffering
> output_buffering = On
>
> ;; Set mb_output_handler to enable output conversion
> output_handler = mb_output_handler
>
> ;; Set HTTP header charset
> default_charset = Shift_JIS
>
> ;; Set default language to Japanese
> mbstring.language = Japanese
>
> ;; Set http input encoding conversion to auto
> mbstring.http_input = auto
>
> ;; Do not print invalid characters
> mbstring.substitute_character = none
>
>
> However, it does not work. Any suggestions would be GREATLY appreciated....
--- End Message ---
--- Begin Message ---
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.
Yes, that's it.
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.
No, I don't. It just appeared from the documentation and what I saw
online that the internal_encoding should be set to EUC. However, I went
and changed the internal_encoding to Shift_JIS and it seems to work.
Any idea if this is a good or bad idea?
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.
Thanks for the tip. Right now, with the internal_encoding set to
Shift_JIS, I don't have the problem any more; however, I'll give it a
try if I'm encouraged not to use Shift_JIS for the internal_encoding.
Thanks again!
--- End Message ---
--- Begin Message ---
>No, I don't. It just appeared from the documentation and what I saw
>online that the internal_encoding should be set to EUC. However, I went
>and changed the internal_encoding to Shift_JIS and it seems to work.
>Any idea if this is a good or bad idea?
There are known mojibake problems with Shift_JIS. See the archives for
more. As David mentioned, EUC-JP would be the better choice, especially
when you're using Japanese in databases with PHP, at least till UTF-8
becomes more widely supported.
Lew
--- End Message ---
--- Begin Message ---
PHPDiscuss - PHP Newsgroups and mailing lists wrote:
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
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)
That's because you set mbstring.internal_encoding to EUC-JP.
mbstring.internal_encoding = EUC-JP
Setting it to Shift_JIS will do the trick, while writing scripts in
Shift_JIS is discouraged.
If you really want to do so, It'd be better to use the zend-multibyte
feature.
Specify --enable-zend-multibyte to configure at build time and setting
mbstring.script_encoding to Shift_JIS in your php.ini.
HTH,
Moriyoshi
--- End Message ---
--- Begin Message ---
Hi!
I am working on a bilingual site for US users - it will be in English and
Spanish... I came across some difficulties formatting dates. I set the
locale depending on language chosen and use strftime to display the
formatting I need. However, it looks like none of the Spanish locales (I am
using es_US, but I tested others) use AM & PM values. I realize that AM & PM
aren't used much outside US, but I believe that Spanish speaking users
within the US will be more familiar with AM/PM notation.
I looked at the source files for locales on the server (I am using Redhat
Linux ES), and, indeed, values that relate to AM / PM are empty.
I am not sure whether there's a PHP way around it, or maybe I should find a
different source for the es_US locale and reinstall it (not sure how to do
it), but so far I had no success finding any information about it... Seems
like everybody else is perfectly happy using 24-hour format for US Spanish
locale on Linux / Unix.
I would appreciate any help!
Thanks
--- End Message ---