From e4b16f225fadb8868f6040c7798f2dd4c4d197e1 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 14 Feb 2010 21:39:44 -0800 Subject: [PATCH] syslocale: setlocale for LC_COLLATE requires encoding to be considered valid. --- collate/syslocale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/collate/syslocale.py b/collate/syslocale.py index 4a67044..1ee2924 100644 --- a/collate/syslocale.py +++ b/collate/syslocale.py @@ -35,9 +35,10 @@ class Collator(collate._abcollator.Collator): def __init__(self, locale_code, encoding=None): locale_code, encoding = collate._locale.getpair(locale_code, encoding) try: - locale.setlocale(locale.LC_COLLATE, locale_code) + setlocale = locale_code + "." + encoding + locale.setlocale(locale.LC_COLLATE, setlocale) except locale.Error: - raise collate.errors.InvalidLocaleError(locale_code) + raise collate.errors.InvalidLocaleError(setlocale) self.locale = locale.getlocale(locale.LC_COLLATE)[0] self.encoding = collate._locale.encoding(encoding) -- 2.30.2