Skip to content

Instantly share code, notes, and snippets.

@astro
Created November 11, 2009 18:24
Show Gist options
  • Save astro/232170 to your computer and use it in GitHub Desktop.
Save astro/232170 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'iconv'
DOC = <<EOD
<?xml version="1.0" encoding="UTF-8"?>
<r>Gauß</r>
EOD
pp = Nokogiri::XML::SAX::PushParser.new
Iconv.open('ISO_8859-1', 'UTF-8') { |cd|
cd.iconv(DOC)
}.chars.each do |ch|
pp << ch
end
pp.finish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment