diff options
-rw-r--r-- | Modules/_tkinter.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 882715f..6c3beef 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -654,7 +654,11 @@ Tkapp_Call(self, args) else { /* Convert UTF-8 to Unicode string */ p = strchr(p, '\0'); - res = PyUnicode_DecodeUTF8(s, (int)(p-s), "ignore"); + res = PyUnicode_DecodeUTF8(s, (int)(p-s), "strict"); + if (res == NULL) { + PyErr_Clear(); + res = PyString_FromStringAndSize(s, (int)(p-s)); + } } } |