From a311497e66a35604b55f4c7af259793fe73006b7 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 19 Jul 2006 16:42:43 +0000 Subject: [PATCH] fall back to ASCII if default locale is None git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3403 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- ChangeLog | 5 +++++ linkcheck/i18n.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 36a6dcee..44923c36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,11 @@ Type: bugfix Changed: linkcheck/checker/urlbase.py + * If default encoding cannot be determined, fall back to ASCII. + Type: bugfix + Changed: linkcheck/i18n.py + Closes: SF bug #1524800 + 4.1 "Tsotsi" (released 29.5.2006) * Wait for spawned threads to finish before shutdown. Gets rid diff --git a/linkcheck/i18n.py b/linkcheck/i18n.py index ea76177c..f1bd1d6a 100644 --- a/linkcheck/i18n.py +++ b/linkcheck/i18n.py @@ -27,6 +27,10 @@ import gettext supported_languages = ['en'] default_language = 'en' default_encoding = locale.getpreferredencoding() +# It can happen that the preferrec encoding is not determinable, which +# means the function returned None. Fall back to ASCII in this case. +if default_encoding is None: + default_encoding = "ascii" def install_builtin (translator, do_unicode): """