aboutsummaryrefslogtreecommitdiff
path: root/odfrecode/recoders/cyrillic.py
diff options
context:
space:
mode:
Diffstat (limited to 'odfrecode/recoders/cyrillic.py')
-rw-r--r--odfrecode/recoders/cyrillic.py151
1 files changed, 151 insertions, 0 deletions
diff --git a/odfrecode/recoders/cyrillic.py b/odfrecode/recoders/cyrillic.py
new file mode 100644
index 0000000..7a3cdda
--- /dev/null
+++ b/odfrecode/recoders/cyrillic.py
@@ -0,0 +1,151 @@
+# vim:encoding=utf-8:fileencoding=utf-8
+#
+# odfrecode
+#
+# (c) 2007,2009 Guido G√ľnther <agx@sigxcpu.org>
+# (c) 2007 Torsten Werner <twerner@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+import recoder
+
+class Cyrillic(recoder.Recoder):
+ """
+ this class maps cyrillic characters from 0x80-0xff to unicode
+ the mapping table is based on code from VeraWeb's madlan converter
+ """
+
+ encoding = 'cyrillic'
+ dst_encoding = 'utf-16-be'
+
+ character_table = {
+ u'\x7f': '\x04\x0c',
+ u'\x80': '\x04\x02',
+ u'\x81': '\x04\x03',
+ u'\x82': '\x20\x1a',
+ u'\x83': '\x04\x53',
+ u'\x84': '\x20\x1e',
+ u'\x85': '\x20\x26',
+ u'\x86': '\x20\x20',
+ u'\x87': '\x20\x21',
+ u'\x88': '\x00\x20',
+ u'\x89': '\x20\x30',
+ u'\x8a': '\x04\x09',
+ u'\x8b': '\x20\x39',
+ u'\x8c': '\x04\x0a',
+ u'\x8d': '\x04\x0c',
+ u'\x8e': '\x04\x0b',
+ u'\x8f': '\x04\x0f',
+ u'\x90': '\x04\x52',
+ u'\x91': '\x20\x18',
+ u'\x92': '\x20\x19',
+ u'\x93': '\x20\x1c',
+ u'\x94': '\x20\x1d',
+ u'\x95': '\x20\x22',
+ u'\x96': '\x20\x13',
+ u'\x97': '\x20\x14',
+ u'\x98': '\x00\x20',
+ u'\x99': '\x21\x22',
+ u'\x9a': '\x04\x59',
+ u'\x9b': '\x20\x3a',
+ u'\x9c': '\x04\x5a',
+ u'\x9d': '\x04\x5c',
+ u'\x9e': '\x04\x5b',
+ u'\x9f': '\x04\x5f',
+ u'\xa0': '\x00\x20',
+ u'\xa1': '\x04\x0e',
+ u'\xa2': '\x04\x5e',
+ u'\xa3': '\x04\x08',
+ u'\xa5': '\x04\x90',
+ u'\xa8': '\x04\x01',
+ u'\xaa': '\x04\x04',
+ u'\xaf': '\x04\x07',
+ u'\xb2': '\x04\x06',
+ u'\xb3': '\x04\x57',
+ u'\xb4': '\x04\x91',
+ u'\xb8': '\x04\x51',
+ u'\xb9': '\x21\x16',
+ u'\xba': '\x04\x54',
+ u'\xbc': '\x04\x58',
+ u'\xbd': '\x04\x05',
+ u'\xbe': '\x04\x55',
+ u'\xbf': '\x04\x57',
+ u'\xc0': '\x04\x10',
+ u'\xc1': '\x04\x11',
+ u'\xc2': '\x04\x12',
+ u'\xc3': '\x04\x13',
+ u'\xc4': '\x04\x14',
+ u'\xc5': '\x04\x15',
+ u'\xc6': '\x04\x16',
+ u'\xc7': '\x04\x17',
+ u'\xc8': '\x04\x18',
+ u'\xc9': '\x04\x19',
+ u'\xca': '\x04\x1a',
+ u'\xcb': '\x04\x1b',
+ u'\xcc': '\x04\x1c',
+ u'\xcd': '\x04\x1d',
+ u'\xce': '\x04\x1e',
+ u'\xcf': '\x04\x1f',
+ u'\xd0': '\x04\x20',
+ u'\xd1': '\x04\x21',
+ u'\xd2': '\x04\x22',
+ u'\xd3': '\x04\x23',
+ u'\xd4': '\x04\x24',
+ u'\xd5': '\x04\x25',
+ u'\xd6': '\x04\x26',
+ u'\xd7': '\x04\x27',
+ u'\xd8': '\x04\x28',
+ u'\xd9': '\x04\x29',
+ u'\xda': '\x04\x2a',
+ u'\xdb': '\x04\x2b',
+ u'\xdc': '\x04\x2c',
+ u'\xdd': '\x04\x2d',
+ u'\xde': '\x04\x2e',
+ u'\xdf': '\x04\x2f',
+ u'\xe0': '\x04\x30',
+ u'\xe1': '\x04\x31',
+ u'\xe2': '\x04\x32',
+ u'\xe3': '\x04\x33',
+ u'\xe4': '\x04\x34',
+ u'\xe5': '\x04\x35',
+ u'\xe6': '\x04\x36',
+ u'\xe7': '\x04\x37',
+ u'\xe8': '\x04\x38',
+ u'\xe9': '\x04\x39',
+ u'\xea': '\x04\x3a',
+ u'\xeb': '\x04\x3b',
+ u'\xec': '\x04\x3c',
+ u'\xed': '\x04\x3d',
+ u'\xee': '\x04\x3e',
+ u'\xef': '\x04\x3f',
+ u'\xf0': '\x04\x40',
+ u'\xf1': '\x04\x41',
+ u'\xf2': '\x04\x42',
+ u'\xf3': '\x04\x43',
+ u'\xf4': '\x04\x44',
+ u'\xf5': '\x04\x45',
+ u'\xf6': '\x04\x46',
+ u'\xf7': '\x04\x47',
+ u'\xf8': '\x04\x48',
+ u'\xf9': '\x04\x49',
+ u'\xfa': '\x04\x4a',
+ u'\xfb': '\x04\x4b',
+ u'\xfc': '\x04\x4c',
+ u'\xfd': '\x04\x4d',
+ u'\xfe': '\x04\x4e',
+ u'\xff': '\x04\x4f',
+ }
+