summaryrefslogtreecommitdiff
blob: 254fdd1c3a907afec177e60443bab73525b7fcb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Patch for #401666: dictl: doesn't work with DICTL_USE_KONWERT

Index: dictd/dictl.in
===================================================================
--- dictd.orig/dictl.in	2008-01-20 17:58:41.000000000 +0100
+++ dictd/dictl.in	2008-01-20 18:02:40.000000000 +0100
@@ -24,11 +24,25 @@
 	# `iconv --help' gives more options than `man iconv' (on my SuSE 9.0 system at least)
 	# the -c makes iconv omit invalid characters from output
 	iconv -c -f $1 -t $2
-    else if test "$DICTL_USE_KONWERT"; then
-	konwert $1-$2
+    elif test "$DICTL_USE_KONWERT"; then
+	sedexpr='
+		/(CP)?(437|8(5[0257]|6[0-69]|74))/	{ s//cp\2/; q }
+		/8859_([1-9])/				{ s//iso\1/; q }
+		/ANSI_X3.4(-19(68|86))?/		{ s//ascii/; q }
+		/(US-)?ASCII/				{ s//ascii/; q }
+		/(CP|WINDOWS-)(125[0-8])/		{ s//cp\1/; q }
+		/ISO([-_]?8859-|8859)([1-9]|1[01345])/	{ s//iso\2/; q }
+		/KOI8-?R/				{ s//koi8r/; q }
+		/KOI8-?U/				{ s//koi8u/; q }
+		/UTF-?8/				{ s//utf8/; q }
+		/VISCII/				{ s//viscii/; q }
+		/.*/					{ s///; q }'
+	from=`echo "$1" | tr a-z A-Z | sed -r -e "$sedexpr"`
+	to=`echo "$2" | tr a-z A-Z | sed -r -e "$sedexpr"`
+	konwert "$from-$to"
     else
 	recode -f $1..$2
-    fi fi
+    fi
 }
 
 #####################################