Replies: 1 comment
-
dom is only valid on text responses, and assumes a character encoding of UTF-8 by default as any other access to ->text does, so attempting to access it will of course cause errors when called on non-text responses. Mojolicious chooses to avoid checking for every possible thing a user may do (for performance and complexity reasons), instead you should only call methods in cases that make sense. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, when you download an URL with
Mojo::UserAgent
and the response is binary e.g. image or pdf and you access the dom, I (sometimes) get many "Malformed UTF-8 character" errors:Minimal example to reproduce:
I think it is because
$@
is not localized ineval
inMojo::Util
.Of course I could check the content-type before accessing the dom, but do you think we could also catch these errors in
Mojo::Util
itself?Beta Was this translation helpful? Give feedback.
All reactions