title: Malformed Farsi characters on AWT
body: <p>When I started programming with the JDK6, I had no problem with <strong>text components</strong>, neither in AWT nor in Swing. </p>
  
  <p>But for labels or titles of <strong>AWT components</strong> I do have a problem. I can't display Farsi characters on AWTs components (in Swing I type them into the source code).</p>
  
  <p>Here's my sample code:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.io.*;
  import java.util.Properties;
  
  public class EmptyFarsiCharsOnAWT extends JFrame{
  
  public EmptyFarsiCharsOnAWT() {
      super("مثال");
      setDefaultCloseOperation(3);
      setVisible(rootPaneCheckingEnabled);
  }
  public static void main(String[] args) throws AWTException, IOException {
      JFrame jFrame = new EmptyFarsiCharsOnAWT();
      MenuItem show ;
      // approach 1 = HardCoding :
      /*
      show = new MenuItem("\u0646\u0645\u0627\u06cc\u0634");
       *
       */
  
      // approach 2 = using simple utf-8 saved text file :
      /*
          BufferedReader in = new BufferedReader(new FileReader("farsiLabels.txt"));
          String showLabel = in.readLine();
          in.close();
  
          show = new MenuItem(showLabel);
       *
       */
  
       // approach 3 = using properties file :
  
      FileReader in = new FileReader("farsiLabels.properties");
      Properties farsiLabels = new Properties();
      farsiLabels.load(in);
      show = new MenuItem(farsiLabels.getProperty("tray.show"));
      PopupMenu popUp = new PopupMenu();
      popUp.add(show);
  
          // creating Tray object
          Image iconIamge = Toolkit.getDefaultToolkit().getImage("greenIcon.png");
  
          TrayIcon trayIcon = new TrayIcon(iconIamge, null, popUp);
          SystemTray tray = SystemTray.getSystemTray();
          tray.add(trayIcon);
  
          jFrame.setIconImage(iconIamge);
      } 
  }
  </code></pre>
  
  <p><strong>These three approaches all work when run with an IDE, but when I make a JAR containing this class (by means of NetBeans > project > clean &amp; build), I don't see the expected characters (it shows EMPTY/BLANK SQUARES)!</strong></p>
  
  <p><strong>Note:</strong>
  It seems I can not attach anything, so the contents of the text file would be this: <code>نمایش</code> and the contents of properties file: </p>
  
  <pre><code>#Sun May 02 09:45:10 IRDT 2010   
  tray.show=نمایش
  </code></pre>
  
  <p>And I think I have to let you know that I posted this question a while ago on <a href="http://forums.sun.com/thread.jspa?threadID=5439373" rel="nofollow noreferrer">SDN</a> and "the Java Ranch" forums and other native forums and still I'm waiting...</p>
  
  <p>By the way I am using latest version of Netbeans IDE...</p>
  
  <p>I will be grateful if anybody has a solution to these damn AWT components never rendering any Farsi character for me...</p>