diff --git a/calendarweek/util.py b/calendarweek/util.py index 3d8c10eae8d052157027cd6d65eee227363033d0..676d6b00177484ffa7bf3d93b18393b272102753 100644 --- a/calendarweek/util.py +++ b/calendarweek/util.py @@ -1,4 +1,4 @@ -from locale import locale_alias, locale_encoding_alias +from locale import getpreferredencoding, locale_alias, locale_encoding_alias from typing import Optional @@ -6,5 +6,7 @@ def normalise_locale(loc: str, enc: Optional[str] = None) -> str: loc = locale_alias.get(loc, loc) if enc: enc = locale_encoding_alias.get(enc.replace("-", ""), enc) - loc = loc.split(".")[0] + "." + enc + else: + enc = getpreferredencoding() + loc = loc.split(".")[0] + "." + enc return loc diff --git a/pyproject.toml b/pyproject.toml index f43ff2769f7fa4c086860ad4f5ccbb2054a312e3..d1fe0e216d4602ffbbd936ad8f0d80de3c739d97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "calendarweek" -version = "0.4.0" +version = "0.4.1" description = "Utilities for working with calendar weeks in Python and Django" authors = ["Dominik George <nik@naturalnet.de>", "Jonathan Weth <git@jonathanweth.de>"] license = "MIT"