From: Oleg Broytman Date: Sat, 29 Jan 2005 18:17:52 +0000 (+0000) Subject: If sys.getdefaultencoding() returns "ascii" - use X-Git-Tag: v4.5.3~326 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=a394f04fc041e42c9b2551a19770dc6e56c047b2;p=bookmarks_db.git If sys.getdefaultencoding() returns "ascii" - use locale.getpreferredencoding() to get user's charset. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@50 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/bkmk_parser.py b/bkmk_parser.py index dfe7ce2..d436741 100755 --- a/bkmk_parser.py +++ b/bkmk_parser.py @@ -1,7 +1,7 @@ """ Parser for Netscape Navigator's and Mozilla's bookmarks.html - Written by BroytMann. Copyright (C) 1997-2004 PhiloSoft Design + Written by BroytMann. Copyright (C) 1997-2005 PhiloSoft Design """ @@ -70,6 +70,13 @@ class BkmkParser(HTMLParser): else: global DEFAULT_CHARSET DEFAULT_CHARSET = sys.getdefaultencoding() + if DEFAULT_CHARSET == "ascii": + try: + import locale + except ImportError: + pass + else: + DEFAULT_CHARSET = locale.getpreferredencoding() def start_title(self, attrs):