[TYPO3-core] RFC: HTMLmail charset

Bernhard Kraft kraftb at kraftb.at
Thu Oct 20 14:17:53 CEST 2005


Martin Kutschker wrote:

> The class has only "magic" (context sensitive) configuration.
> 
> The setting of plain_text_header and htlm_text_header should either be moved out of the constructor or the constructor must get an optional argument for the charset.
[...]
>
> I don't understand the changes to dmailer_prepare, but calling a >
> constructor twice sounds like an ugly hack - and broken API.

You are right.

So I made a second patch now. I had to create another new method :(
The constructor calls "->setCharset" without arguments. The function was
renamed to setCharset because it just set's a class-var to the used
charset. Then the constructor calls the new method
"setContentTypeHeader()" also without arguments.

The method ->setCharset() can get called with the charset to use as
argument from external or derived classes - but those will need to call
->setContentTypeHeader() to also set the headers.

I didn't make the call to ->setContentTypeHeader automatically from
->setCharset, this would result in calling the function again if i.e.
base64 is used.

> Also alternate_charset can never be set except by extending the class.

Now the alternate charset is an argument to the setCharset method.

> getCharset() is called multiple times instead of just once. Why waste CPU cyles when you simply can store the rsult of this function?

now setCharset just get's called once in the constructor (initialization
is a must) but will get called again if you set base64 (see above)

> I don't understand the changes to dmailer_prepare, but calling a constructor twice sounds like an ugly hack - and broken API.

Well. The dmailer fetches a page from the FE. Where shall it know from
in which charset this page is and how it has to get sent via mail ?
The only possibility is to find the <meta http-equiv="Content-Type" ...>
tag and extract the charset from it (at least that is what I did in my
kb_mailcs)


greets,
Bernhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTMLMail_Charset_Fix_2.patch
Type: text/x-patch
Size: 5565 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20051020/961af93b/attachment.bin 


More information about the TYPO3-team-core mailing list