From e29491c25cc3cfc32dff4dfc375c2a56400a21df Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Thu, 28 Jan 2010 20:29:43 -0500 Subject: [PATCH] use getpreferredencoding() instead of getdefaultlocale() to get LOCALE_ENCODING, default to cp1252 if it comes back with US-ASCII (Mac) --- pyfpdb/Configuration.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 09f7ca2e..9c14d16f 100644 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -138,7 +138,11 @@ DATABASE_TYPES = ( DATABASE_TYPE_MYSQL, ) -LOCALE_ENCODING = locale.getdefaultlocale()[1] +#LOCALE_ENCODING = locale.getdefaultlocale()[1] +LOCALE_ENCODING = locale.getpreferredencoding() +if LOCALE_ENCODING == "US-ASCII": + print "Default encoding set to US-ASCII, defaulting to CP1252 instead -- If you're not on a Mac, please report this problem." + LOCALE_ENCODING = "cp1252" ######################################################################## def string_to_bool(string, default=True):