6 Replies Latest reply: Jul 22, 2011 2:22 PM by 877458 RSS

    Mail with Unicode Characters (Cyrillic) in Subject


      how can we send an email with Unicode characters (more specifically, Cyrillic) in the Subject line, using java.awt.Desktop?
      Here is the small piece of code:
      if (!Desktop.isDesktopSupported())
          return false;
      Desktop desktop = Desktop.getDesktop();
      if (!desktop.isSupported(Desktop.Action.MAIL))               
          return false;
      String sURI = "john.doe@company.com?SUBJECT=\u041f\u043e\u0437\u0434\u0440\u0430\u0432";
      URI uri = new URI("mailto", sURI, null);
      MS Outlook will pop open but will show question marks in the subject line (???????).

      When I tried to encode the Unicode string with URLEncoder (or with my own base64 encoder), the subject line shows that string just as it is (encoded).
      String sURI = "john.doe@company.com?SUBJECT=" + URLEncoder.encode("\u041f\u043e\u0437\u0434\u0440\u0430\u0432", "utf-8");
      Can anything be done here? The similar question is applicable also for body of the email.