2

OS: ubuntu 16.04

I am having problems deploying my kivy app to my android phone.

when I type buildozer android_new debug deploy run in the terminal I get the error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1658: orinal not in range(128)

does anyone know how I can fix this?

Josh

Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80
  • Post the full log. – inclement Jun 04 '16 at 13:09
  • Don't print non-ascii chars or use proper encoding before printing them. – jligeza Jun 06 '16 at 11:51
  • Don't bother with printing on android anyway, you'll be able to see it only with logcat, which is pointless for common usage. Make yourself a console in the app such as customized `TextInput` or `Label`, those will handle encodings for you automatically and then you shouldn't encounter these problems. Simple `.text += ` would then satisfy your needs and if you package the app correctly (and if it starts correctly), then you don't even need to use logcat anyway. – Peter Badida Jun 09 '16 at 08:13

1 Answers1

0

I recently had a similar problem when building python/kivy/buildozer environment in Docker. The base image was Ubuntu 16.04, so I think it may work for you, too.

In my case, locale isn't installed by default in the Ubuntu Docker image, so I had to install it with apt-get install -y locales, but I don't think you'll need to do that.

First, run:

locale -a 

This will display all of the locales available on your system. If you see the locale you need listed, then use locale to see what LC_ALL and LANG are set to. If they're not set to what you need, or they are set to POSIX, then skip to step four.

Second, generate the locale file. In my case, I needed the US English version; thus my command was:

locale-gen en_US.UTF-8

If you need a different language, you'll need to look up which filename fits your needs.

Third, updated it like so:

update-locale en_US.UTF-8

Fourth, use the following commands to update the environment variables Buildozer/Python will look for:

export LC_ALL=$(locale -a | grep en_US)
export LANG=$(locale -a | grep en_US)

Note that I am using grep, because I found that the locale files that end up on the local system don't always have the same extension, but the naming convention for the first part of the filename seems to be consistent.

Hildy
  • 510
  • 5
  • 15