do not hardcode output locale

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2568 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-05-06 13:21:10 +00:00
parent b6662a3098
commit 6eb990d227
3 changed files with 17 additions and 6 deletions

View file

@ -6,6 +6,16 @@
Type: bugfix
Changed: linkcheck/configuration.py
* The default output encoding is now that of your locale, and not
the hardcoded iso-8859-15 anymore.
Type: feature
Changed: linkcheck/logger/__init__.py
* Do not generate an empty user config dir ~/.linkchecker by default,
only when needed.
Type: feature
Changed: linkchecker
* Redundant dot path at beginning of relative urls are now removed.
Type: feature
Changed: linkcheck/url.py, linkcheck/tests/test_url.py

View file

@ -112,18 +112,18 @@ Specify output type as \fBtext\fP, \fBhtml\fP, \fBsql\fP,
Default type is \fBtext\fP. The various output types are documented
below.
\fIencoding\fP specifies the output encoding, the default is
\fBiso\-8859\-15\fP.
that of your locale.
Valid encodings are listed at
\fBhttp://docs.python.org/lib/node127.html\fP.
\fBhttp://docs.python.org/lib/standard-encodings.html\fP.
.TP
\fB\-F\fP\fItype\fP[\fB/\fP\fIencoding\fP][\fB/\fP\fIfilename\fP], \fB\-\-file\-output=\fP\fItype\fP[\fB/\fP\fIencoding\fP][\fB/\fP\fIfilename\fP]
Output to a file \fBlinkchecker\-out.\fP\fItype\fP,
\fB$HOME/.linkchecker/blacklist\fP for
\fBblacklist\fP output, or \fIfilename\fP if specified.
\fIencoding\fP specifies the output encoding, the default is
\fBiso\-8859\-15\fP.
that of your locale.
Valid encodings are listed at
\fBhttp://docs.python.org/lib/node127.html\fP.
\fBhttp://docs.python.org/lib/standard-encodings.html\fP.
The \fIfilename\fP part of the \fBnone\fP output type will be ignored,
else if the file already exists, it will be overwritten.
You can specify this option more than once. Valid file output types
@ -319,7 +319,7 @@ configuration files
\fBlinkchecker\-out.\fP\fItype\fP - default logger file output name
\fBhttp://docs.python.org/lib/node127.html\fP - valid output encodings
\fBhttp://docs.python.org/lib/standard-encodings.html\fP - valid output encodings
.SH AUTHOR
Bastian Kleineidam <calvin@users.sourceforge.net>

View file

@ -18,6 +18,7 @@
Output logging support for different formats.
"""
import locale
import sys
import os
import os.path
@ -69,7 +70,7 @@ class Logger (object):
# number of encountered warningss
self.warnings = 0
# encoding of output
self.output_encoding = args.get("encoding", "iso-8859-1")
self.output_encoding = args.get("encoding", locale.getpreferredencoding())
def init_fileoutput (self, args):
"""