From 78260be6f8800d79308599d8376c0c4f7f7dda2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= <john@ankarstrom.se>
Date: Sun, 31 Jan 2021 18:34:37 +0000
Subject: htwrap: Use UTF-8 charset by default, add -C option to disable

---
 htwrap | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/htwrap b/htwrap
index 97fa445..32f38aa 100755
--- a/htwrap
+++ b/htwrap
@@ -3,7 +3,7 @@ rfork E
 
 # htwrap -- create standalone HTML document
 
-flagfmt='t, c charset, d dir, l lang, v doctype'
+flagfmt='t,C, c charset, d dir, l lang, v doctype'
 args='[file ...]'
 
 if(! ifs=() eval `{aux/getflags $*}){
@@ -39,8 +39,12 @@ if(! ~ $#flagl 0) echo -n ' lang="'^$flagl^'"'
 if(! ~ $#flagd 0) echo -n ' dir="'^$flagd^'"'
 echo '>'
 
-if(! ~ $#flagc 0)
-	echo '<meta http-equiv="Content-Type" content="text/html; charset='^$flagc^'">'
+if(~ $#flagC 0){
+	if(! ~ $#flagc 0)
+		echo '<meta http-equiv="Content-Type" content="text/html; charset='^$flagc^'">'
+	if not
+		echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
+}
 
 fn source{
 	if(! ~ $#* 0)
-- 
cgit v1.2.3