Bug #9539

REXML XPath UTF8 encoding problem

Added by mbarcala (Mario Barcala) over 6 years ago. Updated over 6 years ago.

Target version:


I found some problems in REXML when processing XPath expressions with Unicode not ascii characters. I attached a sample script and a sample document. If you see the script output, you will see two different problems:

1) text() XPath function does not work properly when there is an accent or tilde character.

2) two different XPath paths, one with an accent and the other without it, are considered the same.

Thank you,

Mario Barcala


sample.rb (366 Bytes) sample.rb Sample script mbarcala (Mario Barcala), 02/20/2014 09:09 AM
sample.xml (224 Bytes) sample.xml Sample document mbarcala (Mario Barcala), 02/20/2014 09:09 AM

Updated by kou (Kouhei Sutou) over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Applied in changeset r45153.

  • lib/rexml/xmltokens.rb: Add missing non ASCII valid characters
    to element name characters. Now, REXML name tokens exactly
    match "[5] Name" in the XML spec and "[4] NCName" in the
    Namespaces in XML spec. See comment about the details.
    [Bug #9539] [ruby-core:60901]
    Reported by Mario Barcala. Thanks!!!

  • test/rexml/xpath/test_node.rb: Add tests for the above case.

Updated by kou (Kouhei Sutou) over 6 years ago

  • Assignee set to kou (Kouhei Sutou)

Thanks for your report!
I've fixed it in trunk.

It was very helpul that you attach a sample script and sample XML to reproduce the problem. :-)

Also available in: Atom PDF