Skip to content

Bug: String containing apostrophe cannot be set into window.state #1709

@tgz-cz

Description

@tgz-cz

Example code:

import webview

def run_code():
    window.state.test1 = "aaa'bbb"

if __name__ == '__main__':
    global window
    window = webview.create_window('State example', "https://example.org")
    webview.start(run_code, debug=True)

It raises JS error:

[pywebview] WebKitJavascriptError: https://example.org/:1: SyntaxError: Unexpected identifier 'bbb'. Expected ')' to end an argument list. (699)

Tested on:

  • pywebview 6.0
  • Python 3.13.3
  • OS Linux (Ubuntu)
  • with GTK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions