Skip to content

[feature] Watch fails when monitored JSON contains invalid Unicode surrogate escapes #4273

Description

@xingchenfei

Description:

When a monitored webpage occasionally returns malformed JSON containing an invalid Unicode escape sequence, the watch fails with:

Plain Text

Invalid \uXXXX\uXXXX surrogate pair escape at line 1, column 546
For example:

JSON

{
"title": "Example \uD800"
}
The response comes from the monitored website. changedetection.io should handle this more gracefully, for example by replacing invalid surrogate escapes with U+FFFD (�) or falling back to plain-text processing.

Valid surrogate pairs, such as \uD83D\uDE00, should remain unaffected.

A possible fix would be to sanitize invalid surrogate escapes before passing the response to json.loads(), orjson.loads(), or other JSON parsers.

http://jgwalist.881881881.xyz:5008/surrogate-test.json it's a test url.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions