From 9fd8a869616cad617d0db8b022119c35855ea39d Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Tue, 13 Feb 2007 17:36:55 +0000 Subject: [PATCH] Allow utf8x \inputencoding git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17164 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 4 ++++ lib/encodings | 5 +++++ lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_1_5.py | 19 +++++++++++++++++-- src/buffer.C | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index eda72fdd8f..08f3ed1446 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,10 @@ LyX file-format changes -----------------------ยง +2007-02-13 Georg Baum + + * format incremented to 260: Allow utf8x \inputencoding + 2007-02-12 Georg Baum * format incremented to 259: diff --git a/lib/encodings b/lib/encodings index 68dce4af55..db90f31121 100644 --- a/lib/encodings +++ b/lib/encodings @@ -6,6 +6,11 @@ Encoding utf8 utf8 UTF-8 End +# This one is used by many CJK packages. utf8 is supposed to be the successor, +# but does not have all features of utf8x yet. +Encoding utf8x utf8x UTF-8 +End + Encoding iso8859-1 latin1 ISO-8859-1 End diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 4bd8aae94d..d0cba1fa0a 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -74,7 +74,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)), ("1_2", [220], generate_minor_versions("1.2" , 4)), ("1_3", [221], generate_minor_versions("1.3" , 7)), ("1_4", range(222,246), generate_minor_versions("1.4" , 3)), - ("1_5", range(246,260), generate_minor_versions("1.5" , 0))] + ("1_5", range(246,261), generate_minor_versions("1.5" , 0))] def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_5.py b/lib/lyx2lyx/lyx_1_5.py index deae7fc3b5..a57282b256 100644 --- a/lib/lyx2lyx/lyx_1_5.py +++ b/lib/lyx2lyx/lyx_1_5.py @@ -1181,6 +1181,19 @@ def normalize_font_whitespace(document): i = i + 1 + +def revert_utf8x(document): + " Set utf8x encoding to utf8. " + i = find_token(document.header, "\\inputencoding", 0) + if i == -1: + document.header.append("\\inputencoding auto") + else: + inputenc = get_value(document.header, "\\inputencoding", i) + if inputenc == "utf8x": + document.header[i] = "\\inputencoding utf8" + document.inputencoding = get_value(document.header, "\\inputencoding", 0) + + ## # Conversion hub # @@ -1199,9 +1212,11 @@ convert = [[246, []], [256, []], [257, [convert_caption]], [258, [convert_lyxline]], - [259, [convert_accent, normalize_font_whitespace]]] + [259, [convert_accent, normalize_font_whitespace]], + [260, []]] -revert = [[258, []], +revert = [[259, [revert_utf8x]], + [258, []], [257, []], [256, [revert_caption]], [255, [revert_encodings]], diff --git a/src/buffer.C b/src/buffer.C index 68a5f8f9dc..32e172745f 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -141,7 +141,7 @@ using std::string; namespace { -int const LYX_FORMAT = 259; +int const LYX_FORMAT = 260; } // namespace anon -- 2.39.5