Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28577

Re: javax.mail sends mail with broken charset

From Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: javax.mail sends mail with broken charset
Date 2014-05-28 09:01 -0500
Organization A noiseless patient Spider
Message-ID <lm4q7r$n1g$1@dont-email.me> (permalink)
References <lm3vnf$cr9$1@news.m-online.net>

Show all headers | View raw


On 5/28/2014 1:30 AM, Laura Schmidt wrote:
> Hello,
>
> I send mail with javax.mail and I noticed that some special chars are
> broken.
>
> I am using UTF-8 on my development system, where the mail generating
> code is produced. The received mail also contains "charset=UTF-8".
>
> But it's broken. The string "äß" is delivered as "=E4=DF" ( see below).

It's not broken. Well, it's as functional as the mail specifications 
are, which isn't terribly great, but that's beside the point.

> Content-Transfer-Encoding: quoted-printable

See this line? It means that non-ASCII characters (and NUL and "bare" 
CR/LF as well, etc.) are "quoted" using an =XX, where X are hexadecimal 
characters. See section 6.7 of RFC 2045 for more details.

If what you expected was an 8-bit body that you could just slurp and 
understand without needing to do any complicated processing, then you 
are sadly extremely mistaken about how messed up the email 
specifications are. Email cannot be reliably processed via hacked up 
scripts reading/writing it manually; you need to use real libraries. 
I've been doing a running series on my blog on just how insane of a mess 
everything is.

[If you want an example, look at the source of this message to figure 
out how the emoji in my From: header is encoded. And then observe all 
the prior occurrences of people quoting that header and managing to 
mangle it. I find it quite amusing, personally.]

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

javax.mail sends mail with broken charset Laura Schmidt <ls@mailinator.com> - 2014-05-28 08:30 +0200
  Re: javax.mail sends mail with broken charset Lars Enderin <lars.enderin@telia.com> - 2014-05-28 11:13 +0200
    Re: javax.mail sends mail with broken charset Lars Enderin <lars.enderin@telia.com> - 2014-05-28 11:24 +0200
    Re: javax.mail sends mail with broken charset Joerg Meier <joergmmeier@arcor.de> - 2014-05-29 12:55 +0200
  Re: javax.mail sends mail with broken charset Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-05-28 09:01 -0500
  Re: javax.mail sends mail with broken charset Laura Schmidt <ls@mailinator.com> - 2014-05-29 09:19 +0200
    Re: javax.mail sends mail with broken charset Laura Schmidt <ls@mailinator.com> - 2014-05-29 09:35 +0200
      Re: javax.mail sends mail with broken charset Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-05-29 09:48 +0000
      Re: javax.mail sends mail with broken charset Lars Enderin <lars.enderin@telia.com> - 2014-05-29 11:56 +0200
      Re: javax.mail sends mail with broken charset Laura Schmidt <ls@mailinator.com> - 2014-05-30 12:16 +0200
        Re: javax.mail sends mail with broken charset Lars Enderin <lars.enderin@telia.com> - 2014-05-30 13:22 +0200
          Re: javax.mail sends mail with broken charset Lars Enderin <lars.enderin@telia.com> - 2014-05-30 20:01 +0200
  Re: javax.mail sends mail with broken charset Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-05-29 09:43 +0000
  Re: javax.mail sends mail with broken charset Roedy Green <see_website@mindprod.com.invalid> - 2014-05-29 15:31 -0700

csiph-web