E-mail and UTF-8, mb_, etc. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: E-mail and UTF-8, mb_, etc. (/showthread.php?tid=90499) |
E-mail and UTF-8, mb_, etc. - joho - 03-27-2024 Looking at the Email class in CI4, shouldn't things like setMessage() and possibly other functions utilize mb_ functions for trimming, replacing, and so on to support multi-byte data properly? This includes functions like setReplyTo(), setFrom(), and setTo() in regards to the $name parameter, since it's technically possible (I think?) for these to contain multi-byte data. It'd also be nice if the initialize() function had a bool parameter, $clearPrevious = true, that would allow calling initialize() multiple times for additive settings. Or, have another function, config(), which did not clear the previous configuration/settings. With the disclaimer that I've just started looking into the Email class :-) The automatic conversion from HTML to create a plain text part, should probably take <br> and <p> into account. Replace all <br> and <br/> and <br /> to whatever the configured line ending is. Replace all <p> with nothing, and </p> to two times whatever the configured line ending is. I think it's reasonably safe to assume that if you have <br/> and <p> tags in your HTML, you'd want them to "carry" over to a plain text part in some way. RE: E-mail and UTF-8, mb_, etc. - joho - 03-27-2024 My comments about multi-byte handling still stands, I created my own setMessageText() function that is a mix of what was there and something that handles <br/> and <p></p>. This assumes I send my message as HTML: PHP Code: public static function setMessageText( string $message_text ) : void { |