mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
mkencodingtable: support mapping ISO 8859 encoding tables
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# Copyright (C) 2017 Reece H. Dunn
|
||||
#
|
||||
# This file is part of ucd-tools.
|
||||
#
|
||||
# ucd-tools 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ucd-tools 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 ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
def readtable(filename):
|
||||
with open(filename) as f:
|
||||
for line in f:
|
||||
if line == '\n' or line.startswith('#'):
|
||||
continue
|
||||
yield line.split()[0:2]
|
||||
|
||||
table = {}
|
||||
for code, mapped in readtable(sys.argv[1]):
|
||||
table[int(code, 0)] = mapped.lower()
|
||||
|
||||
for code in range(0x80, 0x100):
|
||||
if (code % 8 == 0):
|
||||
print('\t', end='')
|
||||
print('%s, ' % table.get(code, '0xfffd'), end='')
|
||||
if (code % 8 == 7):
|
||||
print('// %02x\n' % (code - 7), end='')
|
||||
Reference in New Issue
Block a user