title: Question marks in email for characters like non-breaking space. It only occurs on Unix and not on Windows
body: <p>I am facing a weird problem related to content type/encoding.
  Here is my Java code snippet below. This code works perfectly fine on a Windows machine where the application server is running on windows and the <a href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol" rel="nofollow">SMTP</a> server for sending emails is also Windows localhost. When I deploy the same code on a Unix server, the email sent for the exact same content contains question marks (???) for special characters like non-breaking white space.</p>
  
  <p>I did a lot of googling, but I did not find any solution. How can I fix this problem? The content types I tried were <a href="https://en.wikipedia.org/wiki/ISO/IEC_8859-1" rel="nofollow">ISO-8859-1</a>, <a href="http://en.wikipedia.org/wiki/UTF-8" rel="nofollow">UTF-8</a> and <a href="https://en.wikipedia.org/wiki/Windows-1252" rel="nofollow">Windows-1252</a>. Nothing helps.</p>
  
  <pre><code>        MimeMessage message = new MimeMessage(session);
                  .............
  
          Multipart mp = new MimeMultipart();
          MimeBodyPart messageBody = new MimeBodyPart();
          messageBody.setContent(mailMessage, "text/html;charset=Windows-1252");
          messageBody.setHeader("Content-Type", "text/html;charset=Windows-1252");
  
          // Add body to the multimedia part
          mp.addBodyPart(messageBody);
          message.setContent(mp);
  
          // Send message
          Transport.send(message);
  </code></pre>