Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FireGento_Logger_Model_Mail: Character-Encoding of Mail Body Option #35

Closed
tkdb opened this issue Jul 21, 2014 · 1 comment
Closed

FireGento_Logger_Model_Mail: Character-Encoding of Mail Body Option #35

tkdb opened this issue Jul 21, 2014 · 1 comment

Comments

@tkdb
Copy link
Contributor

tkdb commented Jul 21, 2014

The FireGento_Logger_Model_Mail backend (Email via SMTP with the help of Zend_Mail) is not specifying any character encoding for the body of the email send out.

This makes it default to the default charset of Zend_Mail:

It defaults to iso-8859-1.

From: Character Sets - Zend_Mail - Version 1.12 Documentation

This is a feature request to add an additional parameter for mail logging to allow setting the body charset encoding. The error messages we pump out on our site for example use Unicode with the popular 8-bit UTF-8 encoding.

I see no reason to adhere to the Zend_Mail fallback to iso-8859-1 in any case, as this should have been us-ascii in the first place (but that is just a note in the margin).

For general reference the "charset" parameter is specified in 4.1.2. Charset Parameter - Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types - RFC2046

Example of a problem receiving logger-email

This is with a german shop and a german error message encoded as UTF-8 as the shop uses it. Excerpt from such an email showing the typical encoding problem due to wrong charset setting ("möglich" instead of "möglich"):

screenshot-encoding
Transliteration: "exception 'Mage_Core_Exception' with message 'Online-Buchung nicht mehr möglich. "

On using UTF-8 as default

It might make sense to use UTF-8 as default, but this need further decision from the project itself as this would introduce a backwards incompatible change.

I do see some reasons for UTF-8 encoding of the error message as for example the JSON string in there has to be UTF-8 encoded implicit anyway. There is a work around with this as the JSON encodes any character in strings not within the US-ASCII repertoire with their UTF-16 Unicode escape sequences, so the JSON string itself is US-ASCII and LATIN-X safe. However, this processing - even more fail safe with common charsets - makes the JSON data harder to read (it's not valid JSON anyway as it's prepended and appended with other texts).

Things to change

This feature request is rather trivial from a first view. Zend_Mail constructor accepts the charset parameter optionally.

After introducing an optional configuration setting for the email logger expecting a character-set string, this value - if set - can just be passed when FireGento_Logger_Model_Mail::getMail() is invoked.

tkdb added a commit to tkdb/firegento-logger that referenced this issue Jul 21, 2014
The default content-type of outgoing logging emails is:

    Content-Type: text/plain; charset=iso-8859-1

As not all sites use iso-8859-1 as charset, an option has been added
to the mail-logger to allow setting your own charset parameter value.

- Added charset setting to mailconfig
- Instantiate Zend_Mail with charset

Ref: firegento#35
tkdb added a commit to tkdb/firegento-logger that referenced this issue Jul 21, 2014
The default content-type of outgoing logging emails is:

    Content-Type: text/plain; charset=iso-8859-1

As not all sites use iso-8859-1 as charset, an option has been added
to the mail-logger to allow setting your own charset parameter value.

- Added charset setting to mailconfig
- Instantiate Zend_Mail with charset

Ref: firegento#35
tkdb added a commit to tkdb/firegento-logger that referenced this issue Jul 21, 2014
The default content-type of outgoing logging emails is:

    Content-Type: text/plain; charset=iso-8859-1

As not all sites use iso-8859-1 as charset, an option has been added
to the mail-logger to allow setting your own charset parameter value.

- Added charset setting to mailconfig
- Instantiate Zend_Mail with charset

Ref: firegento#35
tkdb added a commit to tkdb/firegento-logger that referenced this issue Oct 22, 2014
The default content-type of outgoing logging emails is:

    Content-Type: text/plain; charset=iso-8859-1

As not all sites use iso-8859-1 as charset, an option has been added
to the mail-logger to allow setting your own charset parameter value.

- Added charset setting to mailconfig
- Instantiate Zend_Mail with charset

Ref: firegento#35
@tkdb
Copy link
Contributor Author

tkdb commented Oct 28, 2014

I think I found the problem for duplicate mails. It's fixed already in develop (the queue composite write __destruct() method was not cleaning up composed writers correctly which for mails turned out to send duplicate sendings). The fix in develop is part of 0ca8185. Will implement #45 first as it is right now easier for me to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants