Skip to content

Instantly share code, notes, and snippets.

@Mebus
Last active May 6, 2019 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mebus/b04f7a4d365527d2ee2879300621b90b to your computer and use it in GitHub Desktop.
Save Mebus/b04f7a4d365527d2ee2879300621b90b to your computer and use it in GitHub Desktop.
Convert Matlab scripts from ISO-8859-1 to UTF-8
#!/bin/bash
# This script converts Matlab scripts from ISO-8859-1 to utf-8 (a modern standard)
# requirements: bash, iconv
#
# @author Mebus, https://mebus.github.io
#
for f in $(find . -iname "*.m" -exec file -i {} \; | grep "iso-8859-1" | grep -Eo '^.*\.m')
do
echo $f
iconv -f iso8859-1 -t utf-8 $f > $f.utf8
mv $f.utf8 $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment