Skip to content

UnicodeDecodeError #1187

@DoctorChe

Description

@DoctorChe

Hi,

I'm trying to use Cyrillic in the interface, but app does not start. Here is the code:

main.py

#  -*- coding: utf-8 -*-

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen

class MainScreen(Screen):
    pass

class AnotherScreen(Screen):
    pass

class ScreenManagement(ScreenManager):
    pass

presentation = Builder.load_file("main.kv")

class MainApp(App):
    def build(self):
        return presentation

MainApp().run()

main.kv

#  -*- coding: utf-8 -*-

ScreenManagement:
    MainScreen:
    AnotherScreen:

<MainScreen>:
    name: 'main'

    Button:
        on_release: app.root.current = 'other'
        text: 'Другой экран'
        font_size: 50

<AnotherScreen>:
    name: 'other'

    Button:
        on_release: app.root.current = 'main'
        text: 'back to the home screen'
        font_size: 50

When I run the program on Android, I got:

[INFO ] [Logger ] Record log in /storage/emulated/0/Download/TrafficTaxApp/TrafficTaxApp/.kivy/logs/kivy_17-12-03_2.txt
[INFO ] [Kivy ] v1.9.2-dev0
[INFO ] [Python ] v3.6.2 (default, Oct 29 2017, 05:27:57)
[GCC 7.2.0]
[INFO ] [Factory ] 193 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
Traceback (most recent call last):
File "/storage/emulated/0/Download/TrafficTaxApp/TrafficTaxApp/main.py", line 19, in
presentation = Builder.load_file("main.kv")
File "/data/data/ru.iiec.pydroid3/files/i686-linux-android/lib/python3.6/site-packages/kivy/lang/builder.py", line 290, in load_file
data = fd.read()
File "/data/data/ru.iiec.pydroid3/files/i686-linux-android/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 186: ordinal not in range(128)

On Ubuntu, everything is good.

Any idea on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions