X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=bin%2Fconvert_po_to_utf8;fp=bin%2Fconvert_po_to_utf8;h=c6f74ba71ed45c4b409981fb0b20d5c8562ad97e;hb=9cd5652c1d3c162ea58c79132fb52444da3e2b61;hp=0000000000000000000000000000000000000000;hpb=e21fe28a63572c2760cac1526a5cbc365df94a0c;p=deb%2Fpackages.git diff --git a/bin/convert_po_to_utf8 b/bin/convert_po_to_utf8 new file mode 100755 index 0000000..c6f74ba --- /dev/null +++ b/bin/convert_po_to_utf8 @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +pofile=$1 +charset=$(perl -n -e 's/^.*charset=([\w-]+).*$/uc($1)/e && print' "$pofile") + +echo pofile=$pofile charset=$charset + +if [ "$charset" = "UTF-8" ] +then + echo >&2 charset is already utf-8 + exit 1 +fi + +set -x + +iconv -f $charset -t utf-8 "$pofile" >"$pofile".tmp +perl -p -e 's/charset=([\w-]+)/charset=UTF-8/' "$pofile".tmp >"$pofile" +rm -f "$pofile".tmp