Hi!
When i use sax based parser I can't set encoding of the source.
Sjme of my input files has encodings like ASCII but actually it is ISO_8859_1 or ISO_8859_2.
When i set the encoding to parser via io constructor it just simply not apply it and takes the one from xml header(I mean the wrong one).
Example:
########################
io = %Q{<?xml version="1.0" encoding="ASCII"?>
<rows>
Blah, Blah I'm using the ISO_8859_1
</rows>
}
parser = LibXML::XML::SaxParser.io( io,:encoding => LibXML::XML::Encoding::ISO_8859_1 )
parser.callbacks = SAXParserCallbacks.new()
begin
parser.parse
rescue => e
puts e.inspect
end
##################
output
Fatal error: Premature end of data in tag Omschrijving line 129 at :130.
That is NL language so it has some special symbols.
What can u suggest? Header replacement is not really good variant.
Actually encoding param should work.
|