diff --git a/frontend/luxl.lua b/frontend/luxl.lua index c1e77c663..2bde3f0c9 100644 --- a/frontend/luxl.lua +++ b/frontend/luxl.lua @@ -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, }); diff --git a/spec/unit/opds_spec.lua b/spec/unit/opds_spec.lua index 0bdea704e..3be87d2cf 100644 --- a/spec/unit/opds_spec.lua +++ b/spec/unit/opds_spec.lua @@ -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 = [[ + + +Non-ASCII attributes + +Двадцать тысяч льё под водой +urn:third + + + + +]] + 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()