mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
fix: use os.LookupEnv for LANG check in ensureUTF8Env
Replace manual string slicing with os.LookupEnv which is more idiomatic and correctly handles the edge case where LANG is set to an empty string.
This commit is contained in:
parent
c0b7a2d09f
commit
b34587efda
1 changed files with 3 additions and 5 deletions
|
|
@ -13,12 +13,10 @@ import (
|
|||
// an ASCII-compatible encoding that mangles non-ASCII text.
|
||||
func ensureUTF8Env() []string {
|
||||
env := os.Environ()
|
||||
for _, e := range env {
|
||||
if len(e) > 5 && e[:5] == "LANG=" {
|
||||
return env
|
||||
}
|
||||
if _, ok := os.LookupEnv("LANG"); !ok {
|
||||
env = append(env, "LANG=en_US.UTF-8")
|
||||
}
|
||||
return append(env, "LANG=en_US.UTF-8")
|
||||
return env
|
||||
}
|
||||
|
||||
func (f *Frontend) ClipboardGetText() (string, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue