diff --git a/app.go b/app.go index 13d23ac..f5c82a7 100644 --- a/app.go +++ b/app.go @@ -10,8 +10,11 @@ import ( "strings" "sync" "time" + "unicode/utf8" "golang.org/x/sys/windows/registry" + "golang.org/x/text/encoding/charmap" + "golang.org/x/text/transform" "emly/backend/utils" internal "emly/backend/utils/mail" @@ -517,3 +520,17 @@ func (a *App) IsDebuggerRunning() bool { } return utils.IsDebugged() } + +func (a *App) ConvertToUTF8(s string) string { + if utf8.ValidString(s) { + return s + } + + // If invalid UTF-8, assume Windows-1252 (superset of ISO-8859-1) + decoder := charmap.Windows1252.NewDecoder() + decoded, _, err := transform.String(decoder, s) + if err != nil { + return s // Return as-is if decoding fails + } + return decoded +} diff --git a/config.ini b/config.ini index 5bea096..e03a372 100644 --- a/config.ini +++ b/config.ini @@ -1,6 +1,6 @@ [EMLy] SDK_DECODER_SEMVER="1.3.1" SDK_DECODER_RELEASE_CHANNEL="beta" -GUI_SEMVER="1.3.0" +GUI_SEMVER="1.3.1" GUI_RELEASE_CHANNEL="beta" LANGUAGE="it" \ No newline at end of file diff --git a/frontend/src/lib/components/MailViewer.svelte b/frontend/src/lib/components/MailViewer.svelte index 6114349..2bc34f6 100644 --- a/frontend/src/lib/components/MailViewer.svelte +++ b/frontend/src/lib/components/MailViewer.svelte @@ -1,6 +1,6 @@