diff --git a/examples/keyboard/main.py b/examples/keyboard/main.py index 6f98f1a54..a65be0810 100755 --- a/examples/keyboard/main.py +++ b/examples/keyboard/main.py @@ -204,7 +204,11 @@ class KeyboardScreen(Screen): # def key_up(self, keyboard, keycode): def key_up(self, keyboard, keycode, *args): """ The callback function that catches keyboard events. """ - self.displayLabel.text += u" (up {0[1]})".format(keycode) + # system keyboard keycode: (122, 'z') + # dock keyboard keycode: 'z' + if isinstance(keycode, tuple): + keycode = keycode[1] + self.displayLabel.text += u" (up {0})".format(keycode) class KeyboardDemo(App): diff --git a/kivy/uix/vkeyboard.py b/kivy/uix/vkeyboard.py index 03e9d6fcd..b71e773c5 100755 --- a/kivy/uix/vkeyboard.py +++ b/kivy/uix/vkeyboard.py @@ -124,6 +124,7 @@ from kivy.core.image import Image from kivy.resources import resource_find from kivy.clock import Clock +from io import open from os.path import join, splitext, basename from os import listdir from json import loads @@ -446,7 +447,7 @@ class VKeyboard(Scatter): available_layouts = self.available_layouts if fn[-5:] != '.json': return - with open(fn, 'r') as fd: + with open(fn, 'r', encoding='utf-8') as fd: json_content = fd.read() layout = loads(json_content) available_layouts[name] = layout