Skip to content

Instantly share code, notes, and snippets.

@civitaspo
Created July 7, 2017 12:56
Show Gist options
  • Save civitaspo/262a2f0326fb07ab0e185037af4c03b8 to your computer and use it in GitHub Desktop.
Save civitaspo/262a2f0326fb07ab0e185037af4c03b8 to your computer and use it in GitHub Desktop.
$ ruby test.rb
UTF-8
test_b.rb:8:in `include?': incompatible character encodings: UTF-8 and Windows-31J (Encoding::CompatibilityError)
from test_b.rb:8:in `block in <main>'
from test_b.rb:5:in `open'
from test_b.rb:5:in `<main>'
# encoding: cp932
# frozen_string_literal: true
#
File.open 'testdata' do |f|
while line = f.gets do
puts line.encoding
if line.include?("うう")
puts line
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment