forked from pinard/Recode
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GNU libiconv instead of system iconv
- Loading branch information
Showing
13 changed files
with
79 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
./configure --disable-shared --enable-extra-encodings "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
AC_PREREQ([2.71]) | ||
AC_INIT([recode],[3.7.14],[[email protected]]) | ||
AC_CONFIG_SRCDIR(src/recode.c) | ||
AC_CONFIG_SUBDIRS([libiconv]) | ||
AC_CONFIG_AUX_DIR([build-aux]) | ||
AM_INIT_AUTOMAKE | ||
AC_CONFIG_MACRO_DIR(m4) | ||
|
@@ -110,8 +111,8 @@ AM_GNU_GETTEXT_VERSION(0.19) | |
AM_GNU_GETTEXT(external) | ||
AM_XGETTEXT_OPTION([--from-code=UTF-8]) | ||
|
||
# Output | ||
AC_CONFIG_HEADERS([config.h]) | ||
|
||
AC_CONFIG_FILES([Makefile contrib/Makefile doc/Makefile lib/Makefile | ||
po/Makefile.in src/Makefile src/recode.x | ||
tests/Makefile tests/setup.py]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../libiconv/include/iconv.h.inst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
# Automatically derive Recode table files from various sources. | ||
# Copyright © 1993-2000 Free Software Foundation, Inc. | ||
# Copyright © 1993-2023 Free Software Foundation, Inc. | ||
# François Pinard <[email protected]>, 1993. | ||
|
||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -40,7 +40,7 @@ | |
When `-F' and `-n' are used, process Alain's tables. | ||
""" | ||
|
||
import re, sys, io | ||
import re, sys, os, io | ||
|
||
# Character constants. | ||
REPLACEMENT_CHARACTER = 0xFFFD | ||
|
@@ -98,7 +98,6 @@ def main(self, *arguments): | |
|
||
# Read all data tables. | ||
if self.directory: | ||
import os | ||
os.chdir(self.directory) | ||
if self.iconv: | ||
self.iconv.digest() | ||
|
@@ -464,32 +463,22 @@ def digest(self): | |
canonical[charset.upper()] = charset | ||
|
||
# Read in the encodings.def file. | ||
sys.stdout.write("Reading from `iconv -l'\n") | ||
libc = None | ||
import os | ||
sys.stdout.write("Reading from `iconv_no_18n -l'\n") | ||
names = [] | ||
for line in os.popen('iconv -l'): | ||
if libc is None: | ||
libc = len(line.split('/')) == 3 | ||
if libc: | ||
first, second, empty = line.split('/') | ||
assert empty == '\n', repr(line) | ||
name = second or first | ||
if name not in names: | ||
names.append(name) | ||
self.data.append((name, ())) | ||
else: | ||
aliases = [] | ||
for alias in line.split(): | ||
if alias in canonical: | ||
alias = canonical[alias] | ||
aliases.append(alias) | ||
self.data.append((aliases[0], aliases[1:])) | ||
for line in os.popen('../libiconv/src/iconv_no_i18n -l'): | ||
aliases = [] | ||
for alias in line.split(): | ||
if alias in canonical: | ||
alias = canonical[alias] | ||
aliases.append(alias) | ||
self.data.append((aliases[0], aliases[1:])) | ||
|
||
def complete(self, french): | ||
def write_charset(format, charset): | ||
write(format % charset) | ||
write(format % (charset + "-translit")) | ||
def write_charset_with_aliases(charset, suffix=''): | ||
write(f' "{charset + suffix}",\n') | ||
for alias in aliases[:-1]: | ||
write(f'\t"{alias + suffix}",\n') | ||
write(f'\t"{aliases[-1] + suffix}", NULL,\n') | ||
if not self.do_sources: | ||
return | ||
write = Output(self.SOURCES).write | ||
|
@@ -505,12 +494,11 @@ def write_charset(format, charset): | |
% count) | ||
for charset, aliases in self.data: | ||
if aliases: | ||
write_charset(' "%s",\n', charset) | ||
for alias in aliases[:-1]: | ||
write_charset('\t"%s",\n', alias) | ||
write_charset('\t"%s", NULL,\n', aliases[-1]) | ||
write_charset_with_aliases(charset) | ||
write_charset_with_aliases(charset, '-translit') | ||
else: | ||
write_charset(' "%s", NULL,\n', charset) | ||
write(f' "{charset}", NULL,\n') | ||
write(f' "{charset}-translit", NULL,\n') | ||
write(' NULL\n' | ||
' };\n') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters