File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes create char using unicode value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "create char using unicode value" Watch "create char using unicode value" New topic

create char using unicode value

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
Ok, I know this should be super basic, but I've Googled it and found this helpful webpage that provided a workaround--I just copy the char and paste it into my code. However, it would still be nice to know how to construct the following character knowing that the unicode value is 253:

I appreciate your help,
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
char funnyY = '\U0253';
But, you need a Unicode-savvy viewer to see the actual character.

Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
Remeber, the Unicode values for \u are Hex Based. This would actually be
Also, since char is a number primative you can set it with number.
char crazyY = 253;
Since you set it with a literal, no cast is required.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
I assumed, because the value was called "Unicode value 253", that 253 was hex. I probably should have confirmed the value against the Unicode character set, eh?
I agree. Here's the link:
subject: create char using unicode value
It's not a secret anymore!