diff --git a/kitty/boss.py b/kitty/boss.py index c522a38ed..9dc237578 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -150,7 +150,7 @@ class Boss(Thread): def render(self): if self.pending_title_change is not None: t, self.pending_title_change = sanitize_title(self.pending_title_change or appname), None - glfw.glfwSetWindowTitle(self.window, t) + glfw.glfwSetWindowTitle(self.window, t.encode('utf-8')) if self.pending_icon_change is not None: self.pending_icon_change = None # TODO: Implement this self.char_grid.render() diff --git a/kitty/utils.py b/kitty/utils.py index f00ee2916..03d8027d0 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -35,7 +35,7 @@ def timeit(name, do_timing=False): def sanitize_title(x): - return re.sub(br'\s+', b' ', re.sub(br'[\0-\x19]', b'', x)) + return re.sub(r'\s+', ' ', re.sub(r'[\0-\x19]', '', x)) def get_logical_dpi(): diff --git a/kitty_tests/datatypes.py b/kitty_tests/datatypes.py index 1541b589d..2102a59c0 100644 --- a/kitty_tests/datatypes.py +++ b/kitty_tests/datatypes.py @@ -266,7 +266,7 @@ class TestDataTypes(BaseTest): def test_utils(self): self.ae(tuple(map(wcwidth, 'a1\0コ')), (1, 1, 0, 2)) - self.assertEqual(sanitize_title(b'a\0\01 \t\n\f\rb'), b'a b') + self.assertEqual(sanitize_title('a\0\01 \t\n\f\rb'), 'a b') def test_color_profile(self): c = ColorProfile()