user936580 user936580 - 5 months ago 42
Java Question

Invalid character constant in a UTF-8 character

I'm trying to assign 'o͝' (a phonetic character) to a Character in a Java program, but I get the error "Invalid character constant". My file is using UTF-8 and other phonetic characters work ok, but not this one. It looks as if this character is, in fact, two (an 'o' and a ligature or something like that), but I can not break it is forming parts.

Code example:

Character test = 'o͝';

Any help would be appreciated.


The glyph is called "small letter o with combining double breve" and can, in source, be written as;

String a = "\u006f\u035d";

Since it is a combining character (ie two characters), the resulting value cannot be assigned to a single Java char, you'll need to use a String.