xml4r/libxml-ruby — Issue #34: encoding question
Author: nijikon
Created: 2012-01-05 10:13:33+00:00
State: open

My test case is as follows:

Preparing stream for libxml:
gz=Zlib::GzipReader.open(@params[:report][:file_name])
input = StringIO.new(gz.read)

Checking if encoding is right:
(rdb:1) e input
#
(rdb:1) e input.string.encoding
#

Out stuff to SaxParser:
@p=LibXML::XML::SaxParser.io(input, :encoding => LibXML::XML::Encoding::UTF_8)
@p.callbacks=@callback
@p.parse

Catching attributes in callback:
def callback_start(element,attributes)
debugger

Output of attributes:
(rdb:1) e attributes['keyword']
"saint jude's children C\xC3\xA1ncer cure"
(rdb:1) e attributes['keyword'].encoding
#

My question here is, why strings are return as ASCII-8BIT if I wanted UTF-8?