Skip to content

Escaped characters in CSS are not properly kept #376

Closed

Description

@benoit74

This test is failing:

def test_rewrite_css2(no_js_notify):
    output = (
        HtmlRewriter(
            ArticleUrlRewriter(HttpUrl("http://kiwix.org/"), set()),
            "",
            "",
            no_js_notify,
        )
        .rewrite(
            r'<style>.test { content="\e123" }</style>',
        )
        .content
    )
    assert output == r'<style>.test { content="\e123" }</style>'

Looks like "\e123" is interpreted somehow by the parser.

This is encountered in the wild on https://geo.libretexts.org/Courses/Coastline_College/An_Introduction_To_Geology_-_Coastline_College/01%3A_Understanding_Science/1.01%3A_What_is_Science where we have such inline CSS.

Activity

  1. added
    bug
    on Sep 20, 2024
  2. self-assigned this
    on Sep 20, 2024
  3. removed their assignment
    on Sep 23, 2024
  4. added this to the backlog milestone on Nov 14, 2024
  5. removed
    bug
    on Oct 1, 2026
  6. added theissue type on Oct 1, 2026
  7. Sriram-Nambiar commented on Nov 2, 2026

    @Sriram-Nambiar
    Contributor

    I found that the fix belongs in openzim/python-scraperlib since the CSS serialization logic is implemented there. How should i proceed?

  8. transferred this issue fromopenzim/warc2zimon Nov 2, 2026
  9. modified the milestones: backlog, 5.6.0 on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions