ooo330l10n4: utf8 encoding issue

This commit is contained in:
Ivo Hinkelmann 2010-10-05 19:01:32 +02:00
parent 36524b9df5
commit 519a2b9f2b
2 changed files with 5 additions and 5 deletions

View file

@ -66,11 +66,10 @@ class AbstractL10nTool:
pass
################################################################################################
def format_outputfile(self, filename, language):
extension = filename[filename.rfind('.')+1:]
file = filename[:filename.rfind('.')]
# Python 2.3.x friendly
return self.get_outputfile_format_str().replace('[', '%(').replace(']',')s') % \
{ 'filename': filename, 'fileNoExt': file, 'language': language, 'extension': extension, 'path_prefix': self._options.path_prefix,

View file

@ -56,13 +56,14 @@ class Xhtex(AbstractL10nTool):
if elem.childNodes[0].nodeType == elem.TEXT_NODE and elem.getAttribute("id").strip():
obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
if sdfdata[obj.get_id()]:
elem.childNodes[0].data = str(sdfdata[obj.get_id()].text)
elem.childNodes[0].data = unicode(str(sdfdata[obj.get_id()].text),"utf8")
def merge_title(self, list, sdfdata, lang, inputfilename):
for elem in list:
obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
elem.setAttribute("title", str(sdfdata[obj.get_id()].text))
elem.setAttribute("title", unicode(str(sdfdata[obj.get_id()].text),"utf8"))
# L10N tool
def __init__(self):
@ -97,7 +98,7 @@ class Xhtex(AbstractL10nTool):
try:
f = open(outputfilename, "w+")
str = dom.toxml()
f.write(str)
f.write(str.encode("utf-8"))
except IOError:
print "ERROR: Can not write file " + outputfilename
sys.exit(-1)