Skip to content

Instantly share code, notes, and snippets.

@myokoym
Last active December 1, 2015 14:35
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 myokoym/1dd5c355b18d4be9dc8f to your computer and use it in GitHub Desktop.
Save myokoym/1dd5c355b18d4be9dc8f to your computer and use it in GitHub Desktop.
#!ruby
#encoding = ARGV.shift
#args = ARGV.dup
#args.map! do |arg|
# arg.encode(encoding)
#end
#system(*ARGV)
encoding = ARGV.shift
while line = ARGF.gets
if encoding == "utf-8"
puts line.encode(encoding, invalid: :replace)
else
puts line.force_encoding("utf-8")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment