# -*- coding: ISO-8859-1 -*- #Alex Reutter finds brokenness in text output method import sys from Xml.Xslt import test_harness sheet_1 = """ <xsl:value-of select="Title" />
""" source_1 = """ ]> 一本書 這是第一章. 平 這是第二章. 平 """ source_2 = """\012\012\012\012\012\012\012]>\012\012\012 \344\270\200\346\234\254\346\233\270\012 \012 \351\200\231\346\230\257\347\254\254\344\270\200\347\253\240. 平\012 \012 \012 \351\200\231\346\230\257\347\254\254\344\272\214\347\253\240. 平\012 \012""" expected_1 = expected_2 = """\012 \012 \012 \344\270\200\346\234\254\346\233\270\012 \012 \012 \012 \012""" def Test(tester): tester.startTest("Checking for BIG5 codec") try: import codecs big5_decoder = codecs.getdecoder('big5') except LookupError: try: from encodings import big5 except ImportError: tester.warning( "No BIG5 encoding support for case 1. You can install \n" "BIG5 by downloading and installing ChineseCodes from\n" "ftp://python-codecs.sourceforge.net/pub/python-codecs/") tester.testDone() return else: big5_decode = big5.decode else: big5_decode = lambda s: big5_decoder(s)[0] tester.testDone() b5 = big5_decode(source_1) utf8 = b5.encode("utf-8") source = test_harness.FileInfo(string=utf8) sheet = test_harness.FileInfo(string=sheet_1) test_harness.XsltTest(tester, source, [sheet], expected_1) source = test_harness.FileInfo(string=source_2) sheet = test_harness.FileInfo(string=sheet_1) test_harness.XsltTest(tester, source, [sheet], expected_2) return