I'm writing a simple program which translates phrases from Russian to Morse code, and I have trouble using cyrillic characters in my switch statement. Here's an example of the code:
switch (letter) {
case 'А':
morse_message.append(".- ");
break;
case 'Б':
morse_message.append("-... ");
break;
case 'Ц':
morse_message.append("-.-. ");
break;
...
At first, it didn't compile at all writing something like this:
Morse.java:23: error: unclosed character literal case '╨С': ^ Morse.java:23: error: illegal character: '\u2018' case '╨С':
Then I made some research and tried to compile it with javac -encoding UTF-8 Morse. It worked, but when I execute the code, it just ignores the cyrillic letters. For example, if the translated message is Привет!, it will only show the Morse code for the exclamation mark.
Any ideas how to fix it? I've read a lot about character encoding, and I feel completely lost. The default encoding, which I checked with Charset.defaultCharset(), is windows-1252, and it should work just fine with Russian alphabet. Can it be an IDE problem?