]> git.deb.at Git - deb/packages.git/blob - bin/convert_po_to_utf8
Enable zh-tw
[deb/packages.git] / bin / convert_po_to_utf8
1 #!/bin/sh
2
3 set -e
4
5 pofile=$1
6 charset=$(perl -n -e 's/^.*charset=([\w-]+).*$/uc($1)/e && print' "$pofile")
7
8 echo pofile=$pofile charset=$charset
9
10 if [ "$charset" = "UTF-8" ]
11 then
12     echo >&2 charset is already utf-8
13     exit 1
14 fi
15
16 set -x
17
18 iconv -f $charset -t utf-8 "$pofile" >"$pofile".tmp
19 perl -p -e 's/charset=([\w-]+)/charset=UTF-8/' "$pofile".tmp >"$pofile"
20 rm -f "$pofile".tmp