summaryrefslogtreecommitdiff
path: root/sql/share/errmsg-cnv.sh
blob: ac6243c9a379076b6a6241590c42dbf49508dc75 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# This shell script converts errmsg.txt
# from a mixed-charset format
# to utf8 format
# and writes the result to errmgs-utf8.txt
# 


cat errmsg.txt | while IFS= ; read -r a
do
cs=""

var="${a#"${a%%[![:space:]]*}"}"

case $var in
cze*|hun*|pol*|rum*|slo*)
  cs=latin2
  ;;
dan*|nla*|eng*|fre*|ger*|ita*|nor*|por*|spa*|swe*)
  cs=latin1
  ;;
est*)
  cs=latin7
  ;;
greek*)
  cs=windows-1253
  ;;
jpn*)
  cs=euc-jp
  ;;
jps*)
  cs=shift-jis
  ;;
kor*)
  cs=euc-kr
  ;;
serbian*)
  cs=windows-1250
  ;;
rus*)
  cs=koi8-r
  ;;
ukr*)
  cs=koi8-u
  ;;
*)
  echo $a
esac

if [ "x$cs" != "x" ]
then
  b=`echo $a | iconv -f $cs -t utf-8` ; rc=$?
  if [ "$rc" == "0" ]
  then
    echo "$b"
  else
    echo "# This message failed to convert from $cs, skipped"
  fi
fi
done > errmsg-utf8.txt