[TYPO3-core] RFC: Fix charset encoding in TYPO3 mails (not only direct_mail)

Stanislas Rolland stanislas.rolland at fructifor.ca
Wed Jan 25 17:26:14 CET 2006


Hi Michael,
> This is a CVS patch request.
>
> Problem:
> TYPO3 does not respect the site character set but announces all of them as
> iso-8859-1 instead.
>
> Solution:
> Teach it to learn about different charsets.
>
> Comments:
>
> 1. t3lib_div::plainMailEncoded(): The parameter $dontEncodeSubject has been
> replaced by $dontEncodeHeader. Works more consistently.
>   
+1
> 2. Default output of this function is now 'quoted-printable'. Afaik it makes
> no sense to send non-QPencoded 7bit messages (that was the old default
> setting) because this would crop some of the mail contents.
>   
+1
> 3. The new function t3lib_div::encodeHeader() is mainly needed to find email
> addresses which must stay 7bit in all cases. It splits the headers line by
> line, preserves found email addresses with a special wrap, and encodes all
> other parts.
>
> 4. The charset detection in class.t3lib_dmailer.php was written by Bernhard
> (kb_mailcs). Works absolutely perfect but is not needed anymore after this
> patch.
>   
I don't agree with the charset detection, nor with the getCharSet 
function. I wish for the caller to be able to specify to t3lib_htmlmail 
what charset to use. For example, the Direct Mail module fetches a page 
in order to build its newsletter. The page is thus rendered as in the 
frontend. If config.metaCharset is used in the TS template applicable to 
the page, the page will be rendered with the charset specified by 
config.metaCharset. But your patch forces the use of the backend 
charset. The newsletter will be broken.

I also wish to be able to use 8bit as content-transfer-encoding as it 
could allow to transfer non-ASCII characters without using base64.
> 5. Other than Stanislas' patch before, my version uses chr(10) linebreaks
> when it writes the charset headers. This probably needs to be changed, I'm
> waiting for Stanislas' comment here.
>   
I think it should be changed. See my other post on this issue.
>
> I have also attached a 2nd patch in which I modified the way how the install
> tool sends plain-text test mails. Instead of using mail() it will now use
> t3lib_div::plainMailEncoded().
>   
+1
> Additionally, the 2nd patch fixes the problem that $this->messages was not
> visible on foreign hosts because debug() was used. Now it prints these
> comments using t3lib_div::debug() which means, everybody will see the
> messages.
>
>
> Final notice: I have this patch working on many utf8 websites. It is working
> absolutely perfect, so there should be no problems with this patch.
>   
If your backend is utf-8, try to set config.metaCharset = iso-8859-1 in 
the TS template of the page you fetch to generate your Direct Mail 
newsletter.

I will review the other functions in more details. Please note that the 
next version of Direct Mail will not use t3lib_dmailer. It has been 
completely imported in Direct Mail. My understanding is that it should 
probably be removed from the core.

Regards,
Stanislas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060125/6ff8f4ad/attachment.html 


More information about the TYPO3-team-core mailing list