php-general Digest 23 Nov 2012 04:25:46 -0000 Issue 8050

Topics (messages 319751 through 319753):

Re: Encode e-mail text in UTF-8
        319751 by: MC

Re: Switch - Case Statement Questions
        319752 by: Tedd Sperling

PHP 5.4.9 and PHP 5.3.19 released!
        319753 by: Stas Malyshev

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi,

I have finally found the root issue. Basically, the issue does not lie in imap methods, rather it lies in PHP core.

PHP is not consistent in naming variables inside the $_SERVER array. While running under Apache, it creates $_SERVER['WINDIR'], while running directly from command line it creates $_SERVER['windir']. Because I was checking just the upper case version to do some compatibility work for non-windows systems, the compatibility code were active also on windows resulting in inappropriate line breaks (just \n instead of \r\n) which with combination with the Microsoft's SMTP server results in malformed e-mail.

MC

On 21. 11. 2012 11:30, MC wrote:
what is the recommended way to encode e-mail text in UTF-8?

When the site were running in a single byte code page like iso-8859-2
I were happy with the imap_8bit function and quoted-printable encoding
of e-mails. However, the function does not seem to work correctly for
multi-byte code pages like UTF-8.

Did you use header 'Content-Type:text/html;charset=utf-8' on the email?

No, I am using text/plain content-type, more specifically:
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: QUOTED-PRINTABLE

The result e-mail looks like the following (I've replaced all english
letters with just x):
xxxxý xxxx

x xříxxxx xxxxxxxxx xxxxxx xxěxx x xxxx=xxx xx xxxxxí xxxxxxxxxx
xxxxxxxx x xxxxxxxxxx xxxxxxxxx

x xxxxx=xxx

xxxxxáxx xxxáxxx

The raw encoded version of the above text is the following:
xxxx=C3=BD xxxx=0A=
=0A=
x x=C5=99=C3=ADxxxx xxxxxxxxx xxxxxx xx=C4=9Bxx x xxxx=3Dxxx xx
xxxxx=C3=AD=
  xxxxxxxxxx xxxxxxxx x xxxxxxxxxx xxxxxxxxx=0A=
=0A=
x xxxxx=3Dxxx=0A=
=0A=
xxxxx=C3=A1xx xxx=C3=A1xxx=

The first "=" ("=3D") should be "f" and the second "a".

Or you think it might be a bug in the imap_8bit or imap_mail_compose
function? Parts/attachements which are rendered as BASE64 are not being
malformed, just the quoted printable ones.

Thanks,

MC






--- End Message ---
--- Begin Message ---
On Nov 19, 2012, at 2:46 PM, Stuart Dallas <stu...@3ft9.com> wrote:

> On 19 Nov 2012, at 19:35, Tim Streater <t...@clothears.org.uk> wrote:
> 
>> On 18 Nov 2012 at 14:44, Jim Giner <jim.gi...@albanyhandball.com> wrote: 
>> Just so. Perhaps those who are not grasping the point could re-read their 
>> copy of "The Elements of Programming Style" by Kernighan and Plauger where 
>> this sort of issue is covered.
> 
> And of course, nothing is allowed to have changed since 1978! Using a switch 
> in that manner is normal for me. Should I change my style simply because you 
> don't agree with it? If so, why don't you change your style because I don't 
> agree with that? Code is art; there is no "right" way to do it. Can code be 
> shown to be more efficient, elegant, faster, cleaner? Yes. Right or wrong? No.

+1 for me as well.

Publish data -- January 11, 1976???

This may be your father's book (or grand-father in my case). So, don't confuse 
me with old facts -- buy new ones.

Just look to other languages (such as JAVA) for variations in switch. I think 
php got it right.

After all, while(), if(), do/while() and even for() work around the concept of 
true -- why not switch?

Cheers,

tedd

PS: We've had this conversation many years ago  (but not as far back as 1976).

_____________________
t...@sperling.com
http://sperling.com



--- End Message ---
--- Begin Message ---
The PHP development team announces the immediate availability of PHP
5.4.9 and PHP 5.3.19. These releases fix about 15 bugs. All users of PHP
are encouraged to upgrade to PHP 5.4.9, or at least 5.3.19.

The full list of changes are recorded in the ChangeLog on
http://www.php.net/ChangeLog-5.php

For source downloads of PHP 5.4.9 and PHP 5.3.19 please visit our
downloads page at http://www.php.net/downloads.php

Windows binaries can be found on http://windows.php.net/download/

David Soria Parra, Stanislav Malyshev and Johannes Schlüter
PHP Release Team

--- End Message ---

Reply via email to