Welcome Guest, Not a member yet? Register   Sign In
Email library is not suitable for use with multibyte encoding
#1

[eluser]Unknown[/eluser]
Hello!

I found two bugs in CI Email library.

1) The library use strlen() and substr() functions everywhere. This functions are not suitable for use with multibyte encoding like "UTF-8". The simple reason is that strlen() treat every byte as single sign, so in some cases the signs are "cut in half".

http://imageshack.us/photo/my-images/651...ecode.jpg/

Example solution: You can make wrapper methods for strlen() and substr() in Email class, so UTF is automatically detected. Example:
Code:
private function _substr($str, $offset, $limit) {
   if(strtolower($this->encoding) == 'utf-8') {
       return mb_substr($str, $offset, $limit, 'UTF-8');
   }
   else {
       return substr($str, $offset, $limit);
   }
}

2) When subject is longer than 75 signs it is split to multi lines. Thunderbird doesn't accept multiline subjects, because it expect every header to be single line. So Thunderbird shows only the first line of the subject.
Solution: Whene _prep_q_encoding() method is used for subject formatting should not split the subject to multi lines. It should split the string to lines only if the string is the message (email body).

Excuse me for my bad English.
I hope CI team will fix this bugs in the next version.
#2

[eluser]PhilTem[/eluser]
Thanks for your bug report but please consider posting these bugs on EllisLabs' Github since they don't read here too often (I'm not from Ellislab though).




Theme © iAndrew 2016 - Forum software by © MyBB