Question: I'm using JavaMail to the handle emails. Subject is encoded in following charset:

`Subject: =?x-mac-ce?Q?Wdro=BFenia_znaku_CE?=`

How to decode this using a JavaMail.

Answer: 
Windows [seems to use](https://msdn.microsoft.com/en-us/library/ms537500(v=vs.85).aspx) `x-mac-ce` as an alias for `Windows-1250` codepage (matching the CP1250 JDK charset).

**JavaMail** maintains a map of "MIME to Java" charset aliases internally, as resolved with the 
[MimeUtility.javaCharset](http://grepcode.com/file/repo1.maven.org/maven2/javax.mail/mail/1.4.1/javax/mail/internet/MimeUtility.java#MimeUtility.javaCharset%28java.lang.String%29) method, to handle cases like that.

Unfortunately there is no [mapping](http://grepcode.com/file/repo1.maven.org/maven2/javax.mail/mail/1.4.1/javax/mail/internet/MimeUtility.java#1210) for `x-mac-ce` (at least as of JavaMail 1.6.0), and (AFAIK) there is no extension API provided, to add it.

So the best you can do at the moment is decode the subject line in your application code, like that:

```
MimeUtility.decodeText(
    m.getSubject().replace("x-mac-ce","CP1250")
)

```

**Test**

```
m.setSubject("=?x-mac-ce?Q?Wdro=BFenia_znaku_CE?=");
System.out.printf(
   MimeUtility.decodeText(
       m.getSubject().replace("x-mac-ce","CP1250")
   )
);

>>Wdrożenia znaku CE

```

**Note** 

I've first incorrectly identified the encoding as [Macintosh Central European encoding](https://en.wikipedia.org/wiki/Macintosh_Central_European_encoding) (`x-MacCentralEurope` Java Charset), which does not fully match CP1250, and seems to be a transposed version of it (i.e. 0xBF matches 0xFB e.t.c.).
Obviously x-mac-ce is a non-standard charset. JavaMail depends on the JDK to handle conversion of charset encodings to Unicode strings. If, as described above, x-mac-ce is equivlanet to the CP1250 charset, the JavaMail FAQ explains [how to use the JDK's facilities to map unknown charsets to known charsets](https://javaee.github.io/javamail/FAQ#unsupen).