Closed ghost closed 5 years ago
@dolang commented on May 6, 2018, 9:38 AM UTC:
Looks like a driver problem.
sdl2 - UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 0: invalid start byte
The byte 0x98
is a tilde in Win-1252 (cp1252
) encoding but not valid utf-8
. The following uses a fallback which should fix the problem:
diff --git a/kivy/graphics/shader.pyx b/kivy/graphics/shader.pyx
index 53286893..58b3227c 100644
--- a/kivy/graphics/shader.pyx
+++ b/kivy/graphics/shader.pyx
@@ -630,8 +630,13 @@ cdef class Shader:
# others drivers doesn't include a \0 (which is great.)
if length == 0:
return ""
- cdef bytes ret = msg[:length]
- return ret.split(b'\0')[0].decode('utf-8')
+ cdef bytes ret = msg[:length].split(b'\0')[0]
+ try:
+ return ret.decode('utf-8')
+ except UnicodeDecodeError:
+ # fall back to latin1 in case the message isn't valid utf-8
+ return ret.decode('latin1')
cdef void process_message(self, str ctype, message):
message = message.strip()
Closing as stale, I haven't seen this as an issue any time recently.
@algorys commented on May 6, 2018, 8:06 AM UTC:
Versions
Description
I'm trying to run a simple kivy code under AVD.
Sometimes app run as expected and sometimes app failed with following error:
sdl2 - UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 0: invalid start byte
Code and Logs
Logs when it fails:
Logs when it works:
What I've already tried:
This issue was moved by tshirtman from kivy/kivy/issues/5731.