This patch adds support for the so called Macintosh encoding (applemac in 
inputenc).

This is needed at least to import *.tex files using that encoding (see bug 
5984).

Objections?

Jürgen
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp	(Revision 30043)
+++ src/Buffer.cpp	(Arbeitskopie)
@@ -126,7 +126,7 @@
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 361;  // jspitzm: bibliography custom width
+int const LYX_FORMAT = 362;  // jspitzm: support applemac encoding
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
Index: lib/lyx2lyx/lyx_2_0.py
===================================================================
--- lib/lyx2lyx/lyx_2_0.py	(Revision 30043)
+++ lib/lyx2lyx/lyx_2_0.py	(Arbeitskopie)
@@ -707,6 +707,16 @@
       i = i + 1
 
 
+def revert_applemac(document):
+    " Revert applemac encoding to latin1 "
+    i = 0
+    if document.encoding == "applemac":
+        document.encoding = "auto"
+        i = find_token(document.header, "\\encoding", 0)
+        if i != -1:
+            document.header[i] = "\\encoding auto"
+
+
 ##
 # Conversion hub
 #
@@ -727,10 +737,12 @@
            [358, []],
            [359, [convert_nomencl_width]],
            [360, []],
-           [361, []]
+           [361, []],
+           [362, []]
           ]
 
-revert =  [[360, []],
+revert =  [[361, [revert_applemac]],
+           [360, []],
            [359, [revert_nomencl_cwidth]],
            [358, [revert_nomencl_width]],
            [357, [revert_custom_processors]],
Index: lib/encodings
===================================================================
--- lib/encodings	(Revision 30043)
+++ lib/encodings	(Arbeitskopie)
@@ -61,6 +61,9 @@
 Encoding iso8859-16 latin10 "South-Eastern European (ISO 8859-16)" ISO-8859-16 fixed inputenc
 End
 
+Encoding applemac applemac "Macintosh" Macintosh fixed inputenc
+End
+
 Encoding cp437 cp437 "DOS (CP 437)" CP437 fixed inputenc
 End
 
Index: development/FORMAT
===================================================================
--- development/FORMAT	(Revision 30043)
+++ development/FORMAT	(Arbeitskopie)
@@ -1,6 +1,9 @@
 LyX file-format changes
 -----------------------
 
+2009-06-11 Jürgen Spitzmüller <[email protected]>
+	* Format incremented to 362: support for the applemac encoding.
+
 2009-05-25 Jürgen Spitzmüller <[email protected]>
 	* Format incremented to 361: support for custom setting of
 	  bibliography (longest) label width.

Reply via email to