Default output encoding is now utf-8

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3963 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2009-02-18 16:14:50 +00:00
parent dc537a73d3
commit 01c417c3c3
5 changed files with 14 additions and 8 deletions

View file

@ -3,6 +3,10 @@
* Added email syntax checking.
Closes: SF bug #2595437
* Switch default encoding of output loggers to UTF-8, except the
text logger which also honors the system settings.
Closes: SF bug #2579899
5.0.2 "All the boys love Mandy Lane" (released 13.2.2009)
* Properly detect location of the log configuration file in the Windows

View file

@ -22,7 +22,7 @@ import sys
import os
import datetime
from ..decorators import notimplemented
from .. import log, LOG_CHECK, strformat, i18n, dummy
from .. import log, LOG_CHECK, strformat, dummy
_ = lambda x: x
Fields = dict(
@ -71,8 +71,8 @@ class Logger (object):
self.warnings = 0
# number of warnings that were printed
self.warnings_printed = 0
# encoding of output
self.output_encoding = args.get("encoding", i18n.default_encoding)
# encoding of output (default is utf-8)
self.output_encoding = args.get("encoding", "utf-8")
def init_fileoutput (self, args):
"""

View file

@ -21,6 +21,7 @@ A blacklist logger.
from __future__ import with_statement
import os
from . import Logger
from .. import i18n
class BlacklistLogger (Logger):
@ -35,6 +36,7 @@ class BlacklistLogger (Logger):
Intialize with old blacklist data (if found, else not).
"""
super(BlacklistLogger, self).__init__(**args)
self.output_encoding = args.get("encoding", i18n.default_encoding)
self.init_fileoutput(args)
self.blacklist = {}
if self.filename is not None and os.path.exists(self.filename):

View file

@ -19,7 +19,7 @@ The default text logger.
"""
import time
from . import Logger
from .. import ansicolor, strformat, configuration
from .. import ansicolor, strformat, configuration, i18n
class TextLogger (Logger):
@ -64,6 +64,7 @@ class TextLogger (Logger):
Initialize error counter and optional file output.
"""
super(TextLogger, self).__init__(**args)
self.output_encoding = args.get("encoding", i18n.default_encoding)
self.init_fileoutput(args)
if self.fd is not None:
self.fd = ansicolor.Colorizer(self.fd)

View file

@ -66,14 +66,13 @@ class XMLLogger (Logger):
self.write(s, **args)
self.writeln(u" -->")
def xml_start_output (self, version="1.0", encoding="utf-8"):
def xml_start_output (self):
"""
Write start of checking info as xml comment.
"""
self.output_encoding = encoding
self.starttime = time.time()
self.writeln(u'<?xml version="%s" encoding="%s"?>' %
(xmlquoteattr(version), xmlquoteattr(encoding)))
self.writeln(u'<?xml version="1.0" encoding="%s"?>' %
xmlquoteattr(self.output_encoding))
if self.has_part("intro"):
self.comment(_("created by %(app)s at %(time)s") %
{"app": configuration.AppName,