From 9963e7863618e8363bdbfc1fee417d9910df262c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 8 Sep 2018 23:03:36 +0530 Subject: [PATCH] Linux: Ensure that the python embedded in the kitty binary build always uses UTF-8 mode Fixes #924 --- docs/changelog.rst | 3 +++ linux-launcher.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 42c9d9b25..4984c912f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,9 @@ Changelog - Add a new ``neighboring_window`` function to switch to neighboring windows in the current layout, similar to window movement in vim (:iss:`916`) +- Linux: Ensure that the python embedded in the kitty binary build always uses + UTF-8 mode (:iss:`924`) + 0.12.1 [2018-09-08] ------------------------------ diff --git a/linux-launcher.c b/linux-launcher.c index 9c9665724..c2ba00b15 100644 --- a/linux-launcher.c +++ b/linux-launcher.c @@ -153,6 +153,10 @@ int main(int argc, char *argv[]) { final_argv[i+1] = argv[i]; num_args++; } +#if PY_VERSION_HEX >= 0x03070000 + // Always use UTF-8 mode, see https://github.com/kovidgoyal/kitty/issues/924 + Py_UTF8Mode = 1; +#endif for (i = 0; i < num_args; i++) { argvw[i] = Py_DecodeLocale(final_argv[i], NULL); if (argvw[i] == NULL) {