Re: MBStrings question for in PEAR::Mail_Mime

From: Date: Thu, 18 May 2006 23:16:16 +0000
Subject: Re: MBStrings question for in PEAR::Mail_Mime
References: 1 2  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-1005@lists.php.net to get a copy of this message
Hello,
It'd not be a good idea to use mb_encode_mimeheader() as it is not quite handy when it comes to non-CJK encoding. Instead, you can write a more standard-compliant alternative with mb_substr() / base64_encode(), or possibly iconv_mime_encode() that provides far better functionality, available since php 5.0.
Thanks for the info! I've implemented the iconv_mime_encode function in the Mail_Mime package as you can see at http://cvs.php.net/viewcvs.cgi/pear/Mail_Mime/mime.php?annotate=1.56#l791 In that function, I only call the replacing function if the line to encode contains characters that should be encoded. This is currently done with a regexp but I fear it might not always find all the characters. The regexp I'm using searches for [\x80-\xFF]. This would catch any cyrilic, or otherwise, xtened single byte characters in charsets such as ISO-8859-XX. Would this work in etecting all multibte charaters, or do you know a better way to determine whether or not to encode a line ? Thanks again, Cipri

« previous php.i18n (#1005) next »