Skip to content

Instantly share code, notes, and snippets.

@imzjy
Created May 3, 2013 23:26
Show Gist options
  • Save imzjy/5515078 to your computer and use it in GitHub Desktop.
Save imzjy/5515078 to your computer and use it in GitHub Desktop.
create the GBK to UTF-8(with BOM)
#!/bin/sh
#convert from GBK to UTF-8(with BOM)
#http://stackoverflow.com/questions/4364156/iconv-converting-from-windows-ansi-to-utf-8-with-bom
for file in `find . -iname $1 `
do
echo -ne '\xEF\xBB\xBF' > "$file.new"
iconv -f GBK -t 'UTF-8' "$file" >> "$file.new" &&
mv -f "$file.new" "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment