summaryrefslogtreecommitdiff
path: root/ansi2unicode.sh
blob: bb8e0fb85ba982057c6df761c4af925595dadb68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
#
# Convert code page ANSI file to UTF-16 LE
#

_=$(basename $0)

if [ -z "$1" ] ; then
    echo $_ : usage $_ file ...
    exit 1
fi

FROM=CP1252
TO=UTF-16LE

for i in $@ ; do
    TMP="$i.$$"
    iconv -f $FROM -t $TO "$i" > "$TMP"
    mv "$TMP" "$i"
    insertbom "$i"
done