Skip to content

Commit

Permalink
force unicode/utf8 for html2text
Browse files Browse the repository at this point in the history
  • Loading branch information
wofr06 committed Aug 26, 2024
1 parent b675d61 commit 7ad3a2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
****************************************************************************
# ChangeLog for lesspipe.sh #
****************************************************************************
- force unicode/utf8 for html2text
Version 2.14 Aug 16 2024
- allow for colorizing dotfiles
- add nvimpager as (preferred) colorizer
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ STDOUT and the commands executed to STDERR.
- sxw2txt https://vinc17.net/software/sxw2txt (2010)
- dtc https://git.kernel.org/cgit/utils/dtc/dtc.git (2023)
- xmq https://github.com/libxmq/xmq/releases/latest (2024)
- nvimpager https://github.com/lucc/nvimpager (2025)
- nvimpager https://github.com/lucc/nvimpager (2024)

### 12.2 References
- [1] http://www.greenwoodsoftware.com/less/ (less)
Expand Down
6 changes: 4 additions & 2 deletions lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,15 @@ handle_w3m () {

ishtml () {
[[ $1 == - ]] && arg1=-stdin || arg1="$1"
htmlopt=--unicode-snob
has_cmd html2text && echo ""|html2text -utf8 2>/dev/null && htmlopt=-utf8
# 3 lines following can easily be reshuffled according to the preferred tool
has_cmd elinks && nodash "elinks -dump -force-html" "$1" && return ||
has_cmd w3m && handle_w3m "$1" && return ||
has_cmd lynx && lynx -force_html -dump "$arg1" && return ||
# different versions of html2text existing, therefore no encoding handling
# different versions of html2text existingi, force unicode
[[ "$1" == https://* ]] && return ||
has_cmd html2text && nodash html2text "$1"
has_cmd html2text && nodash html2text "$htmlopt" "$1"
}

# the main program
Expand Down

0 comments on commit 7ad3a2a

Please sign in to comment.