Skip to content

Instantly share code, notes, and snippets.

@takeshy
Created October 11, 2011 08:02
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 takeshy/1277528 to your computer and use it in GitHub Desktop.
Save takeshy/1277528 to your computer and use it in GitHub Desktop.
encodeがわからないファイルをcp932統一する
require 'nkf'
Dir.glob("c:/howm/2011/*/*.howm"){|g|
d = File.read(g)
File.open(g,"w"){|f|
f.write(d.force_encoding(NKF.guess(d)).encode("cp932"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment