Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created April 18, 2012 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save evanphx/2417140 to your computer and use it in GitHub Desktop.
Save evanphx/2417140 to your computer and use it in GitHub Desktop.
# -*- encoding: utf-8 -*-
#
# -
require 'psych'
ary = ["Jakub Kuźma", "Timo Rößner"]
p ary.first.encoding
builder = Psych::Visitors::YAMLTree.new({})
builder << ary
ast = builder.tree
io = StringIO.new
Psych::Visitors::Emitter.new(io).accept(ast)
str = io.string
p str
p str.encoding
str.gsub(/ !!null \n/, " \n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment