]> git.lyx.org Git - features.git/commitdiff
Fix encoding issue with lyx2lyx conversion of "Date" info-insets.
authorGünter Milde <milde@lyx.org>
Wed, 23 Jan 2019 10:06:04 +0000 (11:06 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 12:39:56 +0000 (14:39 +0200)
Remaining problem: the name of the day appears in English instead of the document language.

development/autotests/unreliableTests
lib/lyx2lyx/lyx_2_4.py

index f23fc01b86ec58b2a003c9e790017c200f2062a8..f7a8fc5e7e11ff106e6efe9311e57f94985e5f9e 100644 (file)
@@ -67,9 +67,6 @@ export/examples/(|fr/)seminar_(dvi|pdf).*
 # See also #9744 allow parallel configuration of TeX and non-TeX fonts.
 export/templates/acmart_pdf[45]_texF
 
-# "UnicodeDecodeError" with Python 2
-export/examples/ja/multilingual_lyx.*
-
 
 Sublabel: wrong_output
 ######################
@@ -119,3 +116,7 @@ export/export/latex/ru-accent-ascii_pdf2
 export/templates/acmart_dvi.*
 #export/templates/acmart_ps # not tested by ctest autotests
 export/templates/acmart_pdf
+
+# lyx2lyx back-conversion of "Date" info-inset writes 
+# the name of the day in English instead of Japanese.
+export/examples/ja/multilingual_lyx.*
index 7306193b03617dcbd934905fce9a723b49af10e6..85f7314eaeebbbf7db6f6b52dde86de050af5c4d 100644 (file)
@@ -1094,6 +1094,10 @@ def revert_dateinfo(document):
             fmt = re.sub('[^\'%]d', '%d', fmt)
             fmt = fmt.replace("'", "")
             result = dte.strftime(fmt)
+        if sys.version_info < (3,0):
+            # In Python 2, datetime module works with binary strings,
+            # our dateformat strings are utf8-encoded:
+            result = result.decode('utf-8')
         document.body[i : j+1] = result
         i = i + 1