Attempt 2 at enabling UTF8 by default on new WT

This commit is contained in:
Marcel Schramm 2020-10-21 20:15:22 +02:00
parent f05eccf270
commit 62946ab52f
No known key found for this signature in database
GPG Key ID: 05971054C70EEDC7
2 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,15 @@
package config
import (
"os"
"strings"
)
// DisableUTF8 set to true will cause cordless to replace characters with a
// codepoint higher than 65536 or a runewidth of more than one character.
var DisableUTF8 = true
var DisableUTF8 bool
func init() {
wtSessionValue, avail := os.LookupEnv("WT_SESSION")
DisableUTF8 = !avail || strings.TrimSpace(wtSessionValue) == ""
}

View File

@ -2,14 +2,10 @@ package main
import (
"flag"
"os"
"strings"
"github.com/Bios-Marcel/cordless/config"
)
func init() {
wtSessionValue, avail := os.LookupEnv("WT_SESSION")
disableUTF8Default = !avail || strings.TrimSpace(wtSessionValue) == ""
flag.BoolVar(&config.DisableUTF8, "disable-UTF8", disableUTF8Default, "Replaces certain characters with question marks in order to avoid broken rendering")
flag.BoolVar(&config.DisableUTF8, "disable-UTF8", config.DisableUTF8, "Replaces certain characters with question marks in order to avoid broken rendering")
}