Incorrect display of non-English characters

Hello everyone! I am making an app in Android mode. And I have a problem with displaying non-English characters.
I create a String variable, initialize it with non-English characters (Cyrillic).For example

String myString = “Слава психонавтам”;

And these characters are not displayed correctly (looks like Arabic :slight_smile: ) on an Android device.
If I use Java mode, the characters are displayed correctly.
I tried to implement Cyrillic font from .ttf file.

textFont(createFont(“Roboto-Medium.ttf”, 20, true));

But it doesn’t help.
I suspect that the problem is in the different encoding between ProcessingIDE in Windows and Android. But I don’t understand how to fix it.

This really simple program works on my particular device:

void setup() {
  
}

void draw() {
  background(0);
  textSize(48);
  text("Слава психонавтам", 100,100);
}

Perhaps it’s a device-specific issue where the locale needs to be added somehow?

I used several different Android devices, all devices have incorrect display of Cyrillic letters.
I use Processing 4.3.4 on Windows 10. I think the problem is in the encoding on the computer. Because if I write a string with Cyrillic characters to a .TXT file, save the file in UTF-8 encoding and then read it using

String[ ] lines = loadStrings("list.txt");
text(lines[0], 10, 10);

Everything works fine.

Problem solved! ))))))
This thread helped: Special characters on android mode -- encoding problem
On my Windows machine, I added a new environment variable JAVA_TOOL_OPTIONS and the value -Dfile.encoding=UTF-8. Then I rebooted the computer and everything worked fine.

1 Like