2

I copied all the braille characters into a string array and was hoping to use it to read and print braille characters. However, when I was trying to compile the program.the following error message popped up

enter image description here

    private String[] alphabet= {"⠁","⠃","⠉","⠙","⠑","⠋","⠛","⠓","⠊","⠚","⠅","⠇","⠍","⠝","⠕","⠏","⠟","⠗","⠎","⠞","⠥","⠧","⠭","⠽","⠵","⠯","⠿","⠷","⠮","⠾","⠡","⠣","⠩","⠹","⠱","⠫","⠻","⠳","⠪","⠺","⠂","⠆","⠒","⠲","⠢","⠖","⠶","⠦","⠔","⠴","⠌","⠬","⠼","⠜","⠄","⠤","⠈","⠘","⠸","⠐","⠨","⠰","⠠","⠀"};

this is the string array i was trying to use.

Thanks

Edit:

Update. The program compiles and save just fine after changing the encoding preference or clicking the "save as UTF-8" button. However, I am still unable to print the character like one could with a normal string.

I am looking for sth like this

System.out.println("this is the character: "+ "⠛");

expected output

this is the character: ⠛

actual output

this is the character:

Icarus
  • 501
  • 2
  • 16
  • If you are going to put arbitrary Unicode codepoints into Java source code, you have to tell your IDE (Eclipse?) to use UTF-8 as the encoding for the source code files. Then you need to tell Maven / Ant / Gradle. It might be better to use `\u....` syntax for those codepoints. – Stephen C Jun 16 '20 at 02:26
  • 1
    have you tried this: https://stackoverflow.com/questions/3751791/how-to-change-default-text-file-encoding-in-eclipse – Mohammad Hassany Jun 16 '20 at 02:33
  • Did you try clicking the 'save as UTF-8' button in the dialog? – matt Jun 27 '20 at 10:09
  • Sorry for the late response. Yes the program save and compiles just fine after changing the file encoding preferences. However, I was still unable to print the braille characters I would any other string. i.e System.out.println("this is the character: "+"⠛") – Icarus Jul 09 '20 at 03:14

2 Answers2

0

You need to following path to make the changes in Your eclipse IDE and change file encoding to UTF-8. Preferences --> General --> Workspace --> File Encoding

0

I figured out how to print the braille characters. All I had to do was to print it using its Unicode literal. (2800 - 28FF for braille characters)

for a complete list see https://en.wikipedia.org/wiki/Braille_Patterns

        System.out.println("\u28FF");

will output ⣿

Icarus
  • 501
  • 2
  • 16