mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-13 09:03:11 +00:00
use preferred encoding
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2661 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
6e9539bc60
commit
c53824b0ba
1 changed files with 4 additions and 4 deletions
|
|
@ -49,23 +49,23 @@ from xml.sax._exceptions import SAXParseException
|
|||
|
||||
# default config
|
||||
config = {
|
||||
"charset": u"iso-8859-1",
|
||||
"charset": locale.getpreferredencoding(),
|
||||
"copyright": u"Copyright (C) %d" % datetime.date.today().year,
|
||||
"threads": u"pass",
|
||||
"interpreter": unicode(sys.executable)
|
||||
}
|
||||
|
||||
def read_config (args):
|
||||
encoding = locale.getpreferredencoding()
|
||||
preferred_encoding = config["charset"]
|
||||
longopts = ["threads", "charset=", "copyright="]
|
||||
opts, args = getopt.getopt(args, "", longopts)
|
||||
for opt, arg in opts:
|
||||
if opt == "--threads":
|
||||
config["threads"] = u"gtk.gdk.threads_init()"
|
||||
elif opt == "--copyright":
|
||||
config["copyright"] = arg.decode(encoding)
|
||||
config["copyright"] = arg.decode(preferred_encoding)
|
||||
elif opt == "--charset":
|
||||
charset = arg.decode(encoding)
|
||||
charset = arg.decode(preferred_encoding)
|
||||
try:
|
||||
codecs.lookup(charset)
|
||||
except LookupError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue