# Cyrillic characters in the Android application

**URL:** <https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082>\
**Category:** Processing for Android\
**Created:** [March 27, 2020, 2:48pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082 "2020-03-27T14:48:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dron3903](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@dron3903](https://discourse.processing.org/u/dron3903)\
**Post date:** [March 27, 2020, 2:48pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/1 "2020-03-27T14:48:26Z")

</div>

Hello forum users. I am having a problem with Cyrillic characters. When launching the application on the android, gibberish will turn out. Someone knows how to fix it.  
Здравствуйте форумчане. У меня возникла проблема с кириллическими символами. При запуски приложения на андройд получается тарабарщина. Кто нибудь знает как исправить. ![](https://sun9-11.userapi.com/c854324/v854324905/2172a8/iBfuoWdkmhg.jpg)

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 27, 2020, 9:30pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/2 "2020-03-27T21:30:02Z")

</div>

Hi @dron3903  
Download a font [here](https://fonts2u.com/cyrillic.font), and try this code.  
The name of the font and extension must be exact. Also capital letters.

```auto
PFont myFont; 

void setup() { 
  size(200, 200); 
  background(255); 
  myFont = createFont("CYRIL1.TTF", 28); 
  fill(0);
  textFont(myFont); 
  textAlign(CENTER);
  println(("Привет мир");
} 

void draw() { 
  text("Привет мир", width/2, height/2);
}

```

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [October 18, 2020, 10:35am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/3 "2020-10-18T10:35:24Z")

</div>

> [@noel](#):
>
> ```auto
> PFont myFont; 
> 
> void setup() { 
> size(200, 200); 
> background(255); 
> myFont = createFont("CYRIL1.TTF", 28); 
> fill(0);
> textFont(myFont); 
> textAlign(CENTER);
> println(("Привет мир");
> } 
> 
> void draw() { 
> text("Привет мир", width/2, height/2);
> }
> 
> ```

if  
text(“Привет мир”, width/2, height/2);

wrong text, else…

text(“Ghbdtn vbh”, width/2, height/2);

all ok.  
WTF?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 18, 2020, 1:07pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/4 "2020-10-18T13:07:40Z")

</div>

What Android version in which language are you using, and what wrong text do you get with the code above?

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [October 18, 2020, 4:21pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/5 "2020-10-18T16:21:39Z")

</div>

Unfortunately, I can’t insert a screen from my phone.  
Android 10  
PDE 3.5.3

Why this string dont work?  
char ch = ‘Б’;  
text((int)ch,100,100);

````auto
1. ERROR in C:\Users\Sys\AppData\Local\Temp\android4479333281688038184sketch\app\src\main\java\processing\test\sketch_201018b\sketch_201018b.java (at line 30)
	char ch = 'Р‘';
	          ^^^^
Invalid character constant
----------
1 problem (1 error)

> Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Sys\AppData\Local\Temp\android4479333281688038184sketch\app\build.gradle' line: 71

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Process 'command 'C:\prog\processing-3.5.3-windows64\processing-3.5.3\java\bin\java.exe'' finished with non-zero exit value -1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

```![Screenshot_20201018-132830|230x500](upload://8tykSqLSFS3gsiiFy1JrOieBgN1.jpeg)
````

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 18, 2020, 7:36pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/6 "2020-10-18T19:36:17Z")

</div>

> [@knack](#):
>
> `char ch = 'Р‘';`

The error is because the apostrophe or single quote is the wrong one. The text will be red-colored in the IDE f it’s used properly.  
A lot of my codes are not working on my new phone with Android 10. Even the first code crashes when loading this font. Strangely using the system font, displays the text well now.  
So now I have a lot of work to do.  
I get the value 1041 from your char btw.

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [October 19, 2020, 4:41am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/7 "2020-10-19T04:41:30Z")

</div>

That’s the trouble. I know the symbols I need. For instance …  
text (char (1041), 100,100);  
This is how it works, displays “Б” text (‘Б’, 100,100); does not work and can not find out the number of the symbol to fix it.  
And text (‘Б’, 100,100); does not work on other Android versions.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 19, 2020, 5:13am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/8 "2020-10-19T05:13:25Z")

</div>

I’m using APDE on Android 10, and this code doesn’t give any error.

```auto
void draw() {
  text ('Б', 100,200);
  text (int('Б'), 100, 260);
}

```

![Imaage 1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ae121ec8d9d012292902fac3f837896e3640e107.png)

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 19, 2020, 5:41am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/9 "2020-10-19T05:41:48Z")

</div>

I’ve just tested the same code on a Lollipop (5.1) device, and it works also. (with APDE).

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [October 19, 2020, 5:57am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/10 "2020-10-19T05:57:53Z")

</div>

Do you have a real device or emulator? What system language is installed?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 19, 2020, 6:09am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/11 "2020-10-19T06:09:14Z")

</div>

I use the app APDE (on Play Store), it is the Processing for Android core directly on your device., and compiles in seconds.  
Language on my devices is Portuguese.

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [March 27, 2021, 6:49pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/12 "2021-03-27T18:49:04Z")

</div>

Still, a problem in the PDE environment. Starting with some version, I stopped supporting the Cyrillic alphabet on the android. I had to make a crutch, create an XML file and fill in texts from my phone. In what encoding to translate the Cyrillic PDE and how to fix it, I could not find out.

---

<div class="post-metadata">

**Author:** ![miasoft](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/miasoft/32/1902_2.png) [@miasoft](https://discourse.processing.org/u/miasoft)\
**Post date:** [March 30, 2021, 8:20am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/13 "2021-03-30T08:20:59Z")

</div>

> [@knack](#):
>
> l

I have the same problem with Cyrillic chars on Android.(Processing for Android mode on Windows)😞

---

<div class="post-metadata">

**Author:** ![JoseMY](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josemy/32/2016_2.png) [@JoseMY](https://discourse.processing.org/u/JoseMY)\
**Post date:** [April 2, 2021, 10:10am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/14 "2021-04-02T10:10:54Z")

</div>

Just in case this is related:

I’m not from the Cyrillic-writing part of the world, but in the past I had trouble sharing sketches from my phone (APDE) and my computer (processing for windows in android mode). It seemed that sketches saved in android, saved in a git repository and opened in windows garbled non-US characters as “Á” or “€”.  
I haven’t tested with current version.

I made a forum entry (or maybe a bugzilla entry) about that in the past:

> [@Codepage / Unicode? ISO8859-1? IBM-850?](https://discourse.processing.org/t/codepage-unicode-iso8859-1-ibm-850/6545):
>
> Hi! While I can compile [http://github.com/jgmy/daltonaid.git](http://github.com/jgmy/daltonaid.git) on apde, when I compile that with the Android mode of Processing for Windows all the international characters are turn into garbage (example: á is turned into áÃ). How can I set a codepage / character set in order to specify the right characters to display? Yours, José Moya.

---

<div class="post-metadata">

**Author:** ![knack](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@knack](https://discourse.processing.org/u/knack)\
**Post date:** [July 25, 2021, 6:40am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/15 "2021-07-25T06:40:02Z")

</div>

This is the case when you optimize that one thing and another falls off. It’s a pity.

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 25, 2021, 9:18am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/16 "2021-07-25T09:18:41Z")

</div>

You may want to store the character in a text file. This way depending on the system you could simply exchange the offending chars without the recourse to the Internet.

---

<div class="post-metadata">

**Author:** ![JoseMY](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josemy/32/2016_2.png) [@JoseMY](https://discourse.processing.org/u/JoseMY)\
**Post date:** [August 4, 2021, 7:50am UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/17 "2021-08-04T07:50:24Z")

</div>

After some programming in not-processing java, I found I should use CHCP 65001 _before_ running gradle.

Gradle assumes java files use the current system codepage, so it uses iso-8858-something instead of utf-8.  
In the other hand, APDE uses UTF-8 because android runs on top of linux.

The usage of an external text file could be useful, also.

---

<div class="post-metadata">

**Author:** ![JoseMY](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josemy/32/2016_2.png) [@JoseMY](https://discourse.processing.org/u/JoseMY)\
**Post date:** [August 9, 2021, 5:05pm UTC](https://discourse.processing.org/t/cyrillic-characters-in-the-android-application/19082/18 "2021-08-09T17:05:55Z")

</div>

I have to mend my reply.

Best approach is adding/uncommenting this line in gradle.properties:

org.gradle.jvmargs=-Dfile.encoding=UTF8

Substitue UTF8 by the encoding you are using.
