Closed Tiggerito closed 1 month ago
Do you have some HTML we can use as an example for a test?
getglowingnowskincare(dot)com is an example.
I tried finding a way to make the JSON serializer more forgiving, but I have not found a solid solution yet.
I like the idea of making it an option. That way, people can test for the issue.
Description
Navigating to some pages causes the GetContentAsync method to throw an exception.
Replace domain with getglowingnowskincare;
Expected behavior:
The content is returned.
Actual behavior:
The following exception is thrown:
Versions
19.0.2 net8.0
Solution
I believe there was a recent change in which JSON parser is used, which may have introduced this issue.
The exception relates to poorly formed characters on the page.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#utf-16_characters_unicode_code_points_and_grapheme_clusters
This can be fixed by converting the returned string with its toWellFormed() function.
I created my version of GetContentAsync with the following line changed, and the content was successfully returned: