php-i18n Digest 8 Dec 2006 13:30:30 -0000 Issue 340
Topics (messages 1032 through 1033):
Re: mb_send_mail() does not send UTF-8 encoded messages properly
1032 by: Motin
1033 by: Anastas Giokov
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 ---
Anastas Giokov <agiokov <at> gmail.com> writes:
>
> I am trying to send UTF-8 encoded e-mail message with mail() function,
> overloaded by mb_send_mail(). The following message is recorded in error
> log:
>
> PHP Warning: mb_send_mail() [<a
> href='function.mb-send-mail'>function.mb-send-mail</a>]: Unsupported
> charset ""utf-8"" - will be regarded as ascii in {file}
>
> The message is sent ASCII encoded and is garbled.
>
> mb_language returns 'neutral' as it should be for UTF-8.
>
> I'm using PHP 5.1.6 / Apache 2.2.3 on Debian testing.
>
> Anastas
>
Hi,
I have the exact same problem.
The php sources throwing this error is (from
http://php5.sourcesdb.com/r.php?num=1960)
if (_tran_cs == mbfl_no_encoding_invalid) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported charset \"%s\" -
will be regarded as ascii", charset);
_tran_cs = mbfl_no_encoding_ascii;
}
It seems that the mb_string-extension does not strip away the quotations on
"utf-8". Then, since "\"utf-8\"" != "utf-8" the script endocing is not
considered valid.
But I cannot see where it gets the idea from that the chosen encoding is "utf-8"
with quotation marks... In php.in all I've got is mbstring.internal_encoding =
UTF-8 (without quation as one can see)
Do you have any new light to shed over the subject?
Cheers,
Fredrik
--- End Message ---
--- Begin Message ---
Motin wrote:
> Anastas Giokov <agiokov <at> gmail.com> writes:
>
>
>> I am trying to send UTF-8 encoded e-mail message with mail() function,
>> overloaded by mb_send_mail(). The following message is recorded in error
>> log:
>>
>> PHP Warning: mb_send_mail() [<a
>> href='function.mb-send-mail'>function.mb-send-mail</a>]: Unsupported
>> charset ""utf-8"" - will be regarded as ascii in {file}
>>
>> The message is sent ASCII encoded and is garbled.
>>
>> mb_language returns 'neutral' as it should be for UTF-8.
>>
>> I'm using PHP 5.1.6 / Apache 2.2.3 on Debian testing.
>>
>> Anastas
>>
>>
>
> Hi,
>
> I have the exact same problem.
>
> The php sources throwing this error is (from
> http://php5.sourcesdb.com/r.php?num=1960)
>
> if (_tran_cs == mbfl_no_encoding_invalid) {
> php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported charset \"%s\" -
> will be regarded as ascii", charset);
> _tran_cs = mbfl_no_encoding_ascii;
> }
>
> It seems that the mb_string-extension does not strip away the quotations on
> "utf-8". Then, since "\"utf-8\"" != "utf-8" the script endocing is not
> considered valid.
>
> But I cannot see where it gets the idea from that the chosen encoding is
> "utf-8"
> with quotation marks... In php.in all I've got is mbstring.internal_encoding =
> UTF-8 (without quation as one can see)
>
> Do you have any new light to shed over the subject?
>
> Cheers,
>
> Fredrik
>
>
I made some additional tests and found a workaround for the problem:
turned 'off' function overload for mail(). This works since no character
encoding translation is involved.
I found where the additional quotes are coming from - the mime header of
the message to send is:
Content-Type: text/plain; charset="UTF-8"
When changed the code to send:
Content-Type: text/plain; charset=UTF-8
the error disappeared along with the message body :) Obviously the
encoding is derived from this header.
I will continue to investigate the problem, but it would be better if
somebody from the code authors take care of this problem.
Regards,
Anastas
--- End Message ---