Skip to content

Instantly share code, notes, and snippets.

@fedir
Created Apr 16, 2013
Embed
What would you like to do?
Files with non UTF8 characters in the name detecting and rename
# encoding analyzing
find . | grep -P "[\x80-\xFF]" | iconv -f latin1 -t utf8
# test launch
find . | grep -P "[\x80-\xFF]" | rename -n 'BEGIN {binmode STDIN, ":encoding(latin1)"; use Encode;} $_=encode("utf8", $_)'
# rename
find . | grep -P "[\x80-\xFF]" | rename -n 'BEGIN {binmode STDIN, ":encoding(latin1)"; use Encode;} $_=encode("utf8", $_)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment