From 01c417c3c3db4c027d952202bdfd5172d406601d Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 18 Feb 2009 16:14:50 +0000 Subject: [PATCH] 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 --- ChangeLog.txt | 4 ++++ linkcheck/logger/__init__.py | 6 +++--- linkcheck/logger/blacklist.py | 2 ++ linkcheck/logger/text.py | 3 ++- linkcheck/logger/xmllog.py | 7 +++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7729c61b..282f4214 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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 diff --git a/linkcheck/logger/__init__.py b/linkcheck/logger/__init__.py index 69304c3e..97e77935 100644 --- a/linkcheck/logger/__init__.py +++ b/linkcheck/logger/__init__.py @@ -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): """ diff --git a/linkcheck/logger/blacklist.py b/linkcheck/logger/blacklist.py index d1a35b99..4986e4a7 100644 --- a/linkcheck/logger/blacklist.py +++ b/linkcheck/logger/blacklist.py @@ -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): diff --git a/linkcheck/logger/text.py b/linkcheck/logger/text.py index 4ce8a755..2c1fd35d 100644 --- a/linkcheck/logger/text.py +++ b/linkcheck/logger/text.py @@ -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) diff --git a/linkcheck/logger/xmllog.py b/linkcheck/logger/xmllog.py index 2ea9ac0c..68fcad45 100644 --- a/linkcheck/logger/xmllog.py +++ b/linkcheck/logger/xmllog.py @@ -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'' % - (xmlquoteattr(version), xmlquoteattr(encoding))) + self.writeln(u'' % + xmlquoteattr(self.output_encoding)) if self.has_part("intro"): self.comment(_("created by %(app)s at %(time)s") % {"app": configuration.AppName,