Detection of the wordlist charset

This commit is contained in:
erwanlr
2013-04-13 18:42:33 +02:00
parent 5d327f5060
commit 704c6b1669
5 changed files with 45 additions and 9 deletions

View File

@@ -70,3 +70,12 @@ def puts(o = '')
end
super(o)
end
class File
# @param [ String ] file_path
#
# @return [ String ] The charset of the file
def self.charset(file_path)
%x{file -i #{file_path}}[%r{charset=([^\n]+)\n}, 1]
end
end