Skip to content

Instantly share code, notes, and snippets.

@mcfiredrill
Created April 29, 2012 06:09
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 mcfiredrill/2533948 to your computer and use it in GitHub Desktop.
Save mcfiredrill/2533948 to your computer and use it in GitHub Desktop.
y u not utf-8
# encoding: utf-8
class BlogArticle
def initialize(file)
f = File.read(file)
puts "the encoding: #{f.encoding}"
y = YAML.load(f.split("---\n")[1])
end
# output:
# the encoding: US-ASCII
blog.rb:26:in `split': invalid byte sequence in US-ASCII (ArgumentError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment