1

im trying to store a utf char as following:

char utfChr1 = '\u1F6BF';

wich give me an invalid character constant error.

char utfChr2 = '\uE517';

works fine. I can set the char to FFFF and it works without compiler error. But anything over 65535 (10000) gives me that error. What can I do?

Goran
  • 1,002
  • 3
  • 14
  • 29

1 Answers1

4

The type char is 16-bits in Java. Therefore there is only support for UTF-16.

I would say "don't try to use that as a constant", but I'm not sure what you intend to do with it. You could always read the value from an external source, in an encoding that supports the character you're looking for.

Edit: I see that you wish to use the character SHOWER :)

As you can see from the link, it's encoded as 2 chars in UTF-16: \uD83D\uDEBF

Kayaman
  • 72,141
  • 5
  • 83
  • 121