Share this page 

Display "special character" using UnicodeTag(s): Internationalization


The copyright symbol © :
String COPYRIGHT = "\u00a9";
The registered symbol ® :
String REGISTERED = "\u00ae";
The euro-currency sign € :
String EURO = "\u20ac"
For example :
import java.awt.*;
public class TestUnicode extends java.applet.Applet {

  public static final String COPYRIGHT  = "\u00a9";
  public static final String REGISTERED = "\u00ae";
  public static final String EURO = "\u20ac";

  public void init () {
   setLayout(new FlowLayout());
   Label a = new Label(COPYRIGHT + " R\u00e9al Gagnon");
   Label b = new Label(REGISTERED + " R\u00e9al's Software "
                       + " price : 100 " + EURO);
   add(a);
   add(b);
  }
}

Output :
Java not enabled!

A list of Unicode characters is available at the Unicode organization Web site.

Here a quick list for accented letters :

á\u00e0Á\u00c0
à\u00e1À\u00c1
â\u00e2Â\u00c2
é\u00e9É\u00c9
è\u00e8È\u00c8
ê\u00eaÊ\u00ca
î\u00eeÎ\u00ce
ç\u00e7Ç\u00c7

The Indian rupee symbol ( ₹ HTML entity : ₹) is quite new (2010) so you need to make sure that the Font that you are using has it. To display it from Java, you need to use Swing because AWT won't be able to display it.

import java.awt.*;
import javax.swing.*;

public class TestUnicode extends JApplet {
  public static final String RUPEE = "\u20B9";

  public void init () {
   setLayout(new FlowLayout());

   JLabel b = new JLabel("rupee : " + RUPEE);
   b.setFont(new Font("Arial", Font.PLAIN, 14));
   add(b);
  }
}