Reputation: 235
I would like to concatenate the Rupee Symbol Unicode '\u20B9' to a String in java, but I get the following Error, I am using jre7 it has been told in java docs that java7 supports unicode6.0 where this rupee Symbol is added in that version., I have attached my code ant its output below.
public class no {
public static void main(String[] args) {
String rupee = "\u20B9";
JOptionPane.showMessageDialog(null,"Total Amount"+rupee);
}
}
Upvotes: 1
Views: 662
Reputation: 877
This is not a problem of a string concatenation. It's a problem of the display font. It just doesn't support the character. If I try it on my machine where the standard display fonts have full unicode support, this is the result:
You should try to use a font that has the support, rather than the standard font.
Upvotes: 4
Reputation: 354516
You need a font capable of displaying a glyph for that codepoint. Since the Rupee symbol is relatively new that might be hard. There is no problem with your code here, since you see a square which just means that the font doesn't have a glyph for that character and no suitable other font could be found (assuming that Java does font substitution, I'm not terribly sure of that).
Upvotes: 1