From 936e8b63824d536b1f3dc74bcc69df813f187f94 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Feb 2020 10:22:44 +0530 Subject: [PATCH] py3: Fix unicode spaces being replaced by normal space in the edit metadata dialog Fixes #1863525 [IDEOGRAPHIC SPACE (U+3000) is not treated correctly](https://bugs.launchpad.net/calibre/+bug/1863525) --- src/calibre/gui2/metadata/basic_widgets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index ef0555bcd6..93a61e15b6 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -30,6 +30,7 @@ from calibre.utils.date import ( local_tz, qt_to_dt, as_local_time, UNDEFINED_DATE, is_date_undefined, utcfromtimestamp, parse_only_date, internal_iso_format_string) from calibre import strftime +from calibre.constants import ispy3 from calibre.ebooks import BOOK_EXTENSIONS from calibre.customize.ui import run_plugins_on_import from calibre.gui2.comments_editor import Editor @@ -52,7 +53,7 @@ def save_dialog(parent, title, msg, det_msg=''): def clean_text(x): - return re.sub(r'\s', ' ', x.strip()) + return re.sub(r'\s', ' ', x.strip(), flags=re.ASCII if ispy3 else 0) ''' @@ -221,7 +222,6 @@ class TitleEdit(EnLineEdit, ToMetadataMixin): @property def current_val(self): - title = clean_text(unicode_type(self.text())) if not title: title = self.get_default()