luxl: keep attribute values that are not ASCII (#15758)

char_type classifies ASCII only, and the states that read an attribute value
have no catch-all transition, so the first byte >= 0x80 drops the value.
This commit is contained in:
Igor Velkov authored and GitHub committed 2026-07-29 17:35:30 +02:00
1 parent 74e3ffbdec
commit 607c47cf3c
2 files changed
+29 -8

No files matched your search

+11 -8
View File
@@ -28,6 +28,9 @@ local band = bit.band
1 is letters,
2 are digits (including '.')
3 whitespace
Bytes >= 0x80 count as letters: they only ever appear as part of a UTF-8 sequence, and the
states that accept letters are the ones where such a sequence may legitimately turn up.
--]]
local char_type = ffi.new("const int[256]", {
@@ -39,14 +42,14 @@ local char_type = ffi.new("const int[256]", {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
});
+18
View File
@@ -431,6 +431,24 @@ describe("OPDS module", function()
assert.are.same(entries[2].title, "Second")
assert.are.same(entries[2].link[1].href, "SECOND_IMG")
end)
it("should keep attribute values that are not ASCII", function()
local non_ascii_sample = [[
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Non-ASCII attributes</title>
<entry>
<title>Двадцать тысяч льё под водой</title>
<id>urn:third</id>
<category term="Приключения" label="Приключения"/>
<link href="/opds/sequencebooks/109084" rel="related" type="application/atom+xml" title="Все книги серии «Капитан Немо»"/>
</entry>
</feed>
]]
local catalog = OPDSParser:parse(non_ascii_sample)
local entry = catalog.feed.entry[1]
assert.are.same(entry.category.label, "Приключения")
assert.are.same(entry.link[1].title, "Все книги серии «Капитан Немо»")
end)
end)
describe("OPDS browser module", function()