Skip to content

Commit f228c6f

Browse files
committed
xpath: Fix parsing of non-ASCII names
Fix a long-standing issue where QNames starting with a non-ASCII character would be rejected. This became more visible after "streaming" XPath evaluation was disabled since the latter handled non-ASCII names correctly. Fixes #818.
1 parent bcda764 commit f228c6f

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

result/XPath/tests/unicodesimple

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
========================
3+
Expression: /文書
4+
Object is a Node Set :
5+
Set contains 1 nodes:
6+
1 ELEMENT #E6#96#87#E6#9B#B8

test/XPath/docs/unicode

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<文書>text1</文書>

test/XPath/tests/unicodesimple

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/文書

xpath.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10434,8 +10434,9 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) {
1043410434
} else if (CUR == '/') {
1043510435
NEXT;
1043610436
SKIP_BLANKS;
10437-
if ((CUR != 0 ) &&
10438-
((IS_ASCII_LETTER(CUR)) || (CUR == '_') || (CUR == '.') ||
10437+
if ((CUR != 0) &&
10438+
((IS_ASCII_LETTER(CUR)) || (CUR >= 0x80) ||
10439+
(CUR == '_') || (CUR == '.') ||
1043910440
(CUR == '@') || (CUR == '*')))
1044010441
xmlXPathCompRelativeLocationPath(ctxt);
1044110442
}

0 commit comments

Comments
 (0)