htmlq icon indicating copy to clipboard operation
htmlq copied to clipboard

How to specify charset?

Open dw9694 opened this issue 4 years ago • 2 comments

Hi. How to specify charset?

$ cat /tmp/index.html | htmlq 'title'
<title>������</title>
$ cat /tmp/index.html | htmlq 'h1.maintitle'
<h1 class="maintitle">������</h1>

dw9694 avatar Sep 22 '21 16:09 dw9694

There's no way to do that right now as it pretty much assumes UTF-8 at the moment, but I'll have a look into it.

mgdm avatar Jan 03 '22 21:01 mgdm

I would pipe it through iconv --from-code <your_charset>.

Example: If your file is encoded with windows-1252, you can fix it like that: cat /tmp/index.html | iconv --from-code windows-1252 | htmlq 'title'

Or even simpler: If you want to read from a file directly: iconv --from-code windows-1252 /tmp/index.html | htmlq 'title'

Sematre avatar Jan 11 '22 22:01 Sematre