Skip to content

element name case changes when added to document with different encoding #1158

@dcorrigan

Description

@dcorrigan

Hi,

It looks like element names are serialized in a case-insensitive way if the element is added as a string to a document that declares a different encoding:

# encoding: utf-8
f = <<-EOT
<?xml version="1.0" encoding="us-ascii"?>
<root>
  <p>foo</p>
</root>
EOT
r = Nokogiri.XML(f)
p = r.at_css('p').replace('<yYy>©bar</yYy>')
puts r.to_s

This produces:

<?xml version="1.0" encoding="us-ascii"?>
<root>
  <yyy>&#169;bar</yyy>
</root>

I tested this on nokogiri 1.6.3.1, libxml2 2.8.0. Is this a libxml2 problem, maybe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions