-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use set_html with string longer than 1572834 characters on Windows #1104
Comments
Thanks for the report. I checked the documentation of WebView2 and it states the following:
1,572,834 characters is closer to 3 MB after conversion to UTF-16. I suspect the only way around that is to navigate to a file, virtual hostname or with a custom URI scheme, but those need to be implemented in the library unless you use the native handles and do it yourself. |
Ah, thank you! I was searching for a documented limitation but couldn't find it. |
I know this is a different context, but I've recently been using QWebViewEngine (which is a Chomium wrapper) of the QT libraries. And, on the setHtml method documentation we read, “Content larger than 2 MB cannot be displayed, because setHtml() converts the provided HTML to percent-encoding and places data: in front of it to create the URL that it navigates to.” |
I'm not quite sure exactly how the numbers add up to 2 MiB but here's my partial guess.
These numbers add up to 1572864 bytes or 1.5 MiB before conversion to UTF-16. |
What OS are you using (
uname -a
, or Windows version)?Windows 10, 19045.4291.
IE: 11.0.19041.3636
What programming language are you using (C/C++/Go/Rust)?
C++, MSVC v142
What did you expect to see and what you saw instead?
If I try to use
set_html
with a string longer than 1,572,834 characters on windows, the HTML never loads. The devtools inspector shows an empty HTML document. A string of exactly 1,572,834 characters loads fine and quickly, but 1,572,835 never loads. FWIW, I suspect that due to UTF-16 conversion inwiden_string
, the string is effectively doubled in size.I cannot repro this on mac, and have been able to use
set_html
with significantly longer strings there.You can repro with the attached script, just pass the desired html size as an argument:
The text was updated successfully, but these errors were encountered: