diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-04-04 15:37:28 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-04-04 15:47:18 -0700 |
| commit | 2e1aec0fcfd412cff22cc4fc996973e403589ad8 (patch) | |
| tree | 6be4564a21229eb9c15602ffdc8e2370b7f72242 /hotline/server.go | |
| parent | dd81e2cf8030aaea778677270d2a1b6ed218d6b8 (diff) | |
Add support for Mac Roman character encoding.
https://en.wikipedia.org/wiki/Mac_OS_Roman
Diffstat (limited to 'hotline/server.go')
| -rw-r--r-- | hotline/server.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hotline/server.go b/hotline/server.go index e4232b6..f4eef9b 100644 --- a/hotline/server.go +++ b/hotline/server.go @@ -8,6 +8,7 @@ import ( "fmt" "github.com/go-playground/validator/v10" "go.uber.org/zap" + "golang.org/x/text/encoding/charmap" "gopkg.in/yaml.v3" "io" "io/fs" @@ -29,6 +30,12 @@ type requestCtx struct { remoteAddr string } +// Converts bytes from Mac Roman encoding to UTF-8 +var txtDecoder = charmap.Macintosh.NewDecoder() + +// Converts bytes from UTF-8 to Mac Roman encoding +var txtEncoder = charmap.Macintosh.NewEncoder() + type Server struct { NetInterface string Port int |