title: Encoding Hebrew Text for HTML e-mail body Error
body: <p>I've developed a program that eventually sends an e-mail of confirmation.
  I need the Email to be sent in Hebrew.
  so, I first tried to send the body text in plain text, it was fine, but in order to align the text RIGHT-TO-LEFT, I have to format it as HTML.</p>
  
  <p>First I used:</p>
  
  <pre><code>    mbp1.setContent(new String(message.getBytes("UTF8"),"ISO-8859-1"), "text/html");
  </code></pre>
  
  <p><strong>the Western European" character set, it worked fine in MS outlook, but Gmail gave me gibberish.</strong></p>
  
  <p>Then I changed it to:</p>
  
  <pre><code>    mbp1.setContent(new String(message.getBytes("UTF8"),"ISO-8859-8-i"), "text/html");
  </code></pre>
  
  <p><strong>which now works perfect !!!</strong>
  <strong>only that I get a weird error message from java every time i send an e-mail:</strong></p>
  
  <pre><code>     java.io.UnsupportedEncodingException: ISO-8859-8-E
   at java.lang.StringCoding.decode(Unknown Source)
   at java.lang.String.&lt;init&gt;(Unknown Source)
   at java.lang.String.&lt;init&gt;(Unknown Source)
   at GoogleMail.Send(GoogleMail.java:78)
   at GoogleMail.Send(GoogleMail.java:31)
   at MainFrame.sendButtonActionPerformed(MainFrame.java:596)
   at MainFrame.access$3(MainFrame.java:563)
   at MainFrame$3.actionPerformed(MainFrame.java:423)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.awt.EventQueue$4.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
  </code></pre>
  
  <p><strong>everything now works fine, and the error is not aborting my app, but it pisses me off to have an error like this when I don't know its roots.</strong></p>
  
  <p><strong>UPDATE</strong>
  16.09.2014 12:34</p>
  
  <p>I have just compiled my app to a jar file, and when I run it on Win7 with the ISO-8859-8-I encoding I get gibrish in outlook and gmail !!!</p>
  
  <p><strong>it only worked fine inside eclipse !</strong></p>
  
  <p>I have to try setting it back to ISO-8859-1 or ISO-8859-8.
  will update !</p>
  
  <p>Please Help !!!</p>
  
  <p>10x</p>
  
  <p>Dave.</p>
  
  <p><strong>UPDATE 2</strong>
  16.09.2014 13:18</p>
  
  <p>I tried to use your JCharset as <a href="https://stackoverflow.com/users/4017037/stacky">stacky</a> suggested in order to use ISO-8859-I without an error.
  it did fix the eclipse error but screwed everything else.
  Now I use the ISO-8859-1 charset.</p>
  
  <p>When I receive the message on outlook its perfect:
  מק"ט: 19
  התקבל ב: 2014-09-16
  בשעה: 13:00:24
  שם הפרוייקט: 
  שם מזמין העבודה: </p>
  
  <p>BUT, When I receive the message on Gmail, it’s all scrambled:
  ×ž×§"×˜: 19
  ×”×ª×§×‘×œ ×‘: 2014-09-16
  ×‘×©×¢×”: 13:00:24
  ×©× ×”×¤×¨×•×™×™×§×˜: 
  ×©× ×ž×–×ž×™×Ÿ ×”×¢×‘×•×“×”: </p>
  
  <p>I tried to play with the browsers encoding settings, but no such luck, 
  It's now set to Unicode-UTF 8</p>
  
  <p>Any Ideas?</p>