You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using elinks to render HTML messages in mutt. Recently, I noticed a delay when opening certain HTML messages. I traced it back to elinks, probably this line:
I also use python hooks for a different purpose, so they simply return the argument in this case, but this triggers the delay.
You can verify like so:
$ rm -rf ~/.config/elinks
# Create file in"wrong" encoding
$ echo'<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>Ö</body></html>'> test.html
$ iconv -f utf8 -t ISO8859-15 test.html > test-iso.html
$ touch .config/elinks/hooks.py
# This is quick
$ time elinks -dump test-iso.html elinks -dump test-iso.html 0.02s user 0.01s system 100% cpu 0.032 total
$ mkdir -p ~/.config/elinks &&echo'def pre_format_html_hook(url, html):\n return html'>~/.config/elinks/hooks.py
# This is slow
$ time elinks -dump test-iso.htmlELinks: [Python 3.12.5 error] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 62: invalid continuation byte ╓elinks -dump test-iso.html 0.03s user 0.01s system 1% cpu 3.039 total
I suppose the intent is that the error is loud so that the user notices. However, in this case, I'd rather have it fail silently and see a few corrupt characters. Or bail out entirely and return a non-zero exit code, then I would have found the issue sooner.
$ elinks --versionELinks 0.18.GIT d501d762eab59cc4e3cd432b25a36a60bc9aec91Built on Aug 26 2024 10:50:18
What do you think about making that sleep argument as an option, or maybe add an environment variable so I can control this? The error could also go to a log file or something.
(As a workaround I now pipe the file through iconv first to make sure it's always utf8.)
The text was updated successfully, but these errors were encountered:
I'm using elinks to render HTML messages in mutt. Recently, I noticed a delay when opening certain HTML messages. I traced it back to elinks, probably this line:
elinks/src/scripting/scripting.c
Line 47 in d501d76
I also use python hooks for a different purpose, so they simply return the argument in this case, but this triggers the delay.
You can verify like so:
I suppose the intent is that the error is loud so that the user notices. However, in this case, I'd rather have it fail silently and see a few corrupt characters. Or bail out entirely and return a non-zero exit code, then I would have found the issue sooner.
What do you think about making that sleep argument as an option, or maybe add an environment variable so I can control this? The error could also go to a log file or something.
(As a workaround I now pipe the file through iconv first to make sure it's always utf8.)
The text was updated successfully, but these errors were encountered: