#66 Unicode support for email is incorrect

closed-accepted
nobody
None
5
2008-01-09
2007-12-01
Jon
No

Initially observed in: 1.9.3
Also Tested in: 1.9.4rc3 (the live example site)

The Unicode encoding for the subject line of the alert emails is incorrect, the supplied topic for the report was:
testing=testing_testing

Which generates a subject line of:
[REVIEW] Topic Created "testing=testing_testing"

Although this is UTF-8 encoded, which is where the problem lies. The expected raw subject line obtained is:
=?UTF-8?Q?[REVIEW]_Topic_Created_"testing=3Dtesting=5Ftesting"?=

The raw email subject line obtained is:
=?UTF-8?Q?[REVIEW] Topic Created "testing=3Dtesting_testing"?=

Spaces are not allowed in that encoding according to RFC 2047. They need to be encoded with an underscore. obviously any existing underscores need to be encoded to the hex code for that ascii character so that they aren't clobbered.

I've attached the email with the bad subject line, I'll try to attach a fixed copy after posting this.

Discussion

  • Jon
    Jon
    2007-12-01

    Example broken file

     
    Attachments
  • Jon
    Jon
    2007-12-01

    Sample corrected email

     
    Attachments
  • Jon
    Jon
    2007-12-01

    Logged In: YES
    user_id=280202
    Originator: YES

    Attaching a fixed copy of the same email.
    File Added: fixed.txt

     
  • Jon
    Jon
    2007-12-01

    Logged In: YES
    user_id=280202
    Originator: YES

    Well I can't say that I've tested this on a live site, but the attached patch should fix the emailing problem. It also fixes another little issue I noticed where encode("UTF-8", $string) should only be used if is_utf($string) is true.

    Is the live demo setup for true Unicode? It doesn't seem to like it much:
    http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5590019&action=view&mode=1&brmode=1&fview=-1

    I tried submitting a ticket for "Комитет государственной безопасности" (KGB in cyrillic)
    File Added: unicode-email.diff

     
  • Jon
    Jon
    2007-12-01

    Patch to fix email

     
    Attachments
  • Jon
    Jon
    2007-12-01

    Logged In: YES
    user_id=280202
    Originator: YES

    Patch verified against install of CodeStriker 1.9.4 with PostgreSQL backend. I'm not sure it fixes everything, but it seems to generate proper email headers now.

    PS: The Live site isn't setup for Unicode. It worked fine when I tried that on my own install.
    File Added: unicode-email.diff

     
  • David Sitsky
    David Sitsky
    2008-01-09

    Logged In: YES
    user_id=208928
    Originator: NO

    Thanks for that - have committed it in.

     
  • David Sitsky
    David Sitsky
    2008-01-09

    • status: open --> closed-accepted