summaryrefslogtreecommitdiff
path: root/ansi2unicode.sh
blob: 2272ab979eeee3f22ffee13797f9d27558a4dbdc (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
#!/bin/bash
#
# Convert code page ANSI file to UTF-16 LE
#

NAME=$(basename $0)

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

# Spanish/Portugeuse
FROM=CP1252

# Chinese (simplified)
#FROM=CP936

TO=UTF-16LE

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