ooo330l10n4: utf8 encoding issue
This commit is contained in:
parent
36524b9df5
commit
519a2b9f2b
2 changed files with 5 additions and 5 deletions
|
@ -66,11 +66,10 @@ class AbstractL10nTool:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
def format_outputfile(self, filename, language):
|
def format_outputfile(self, filename, language):
|
||||||
extension = filename[filename.rfind('.')+1:]
|
extension = filename[filename.rfind('.')+1:]
|
||||||
file = filename[:filename.rfind('.')]
|
file = filename[:filename.rfind('.')]
|
||||||
|
|
||||||
# Python 2.3.x friendly
|
# Python 2.3.x friendly
|
||||||
return self.get_outputfile_format_str().replace('[', '%(').replace(']',')s') % \
|
return self.get_outputfile_format_str().replace('[', '%(').replace(']',')s') % \
|
||||||
{ 'filename': filename, 'fileNoExt': file, 'language': language, 'extension': extension, 'path_prefix': self._options.path_prefix,
|
{ 'filename': filename, 'fileNoExt': file, 'language': language, 'extension': extension, 'path_prefix': self._options.path_prefix,
|
||||||
|
|
|
@ -56,13 +56,14 @@ class Xhtex(AbstractL10nTool):
|
||||||
if elem.childNodes[0].nodeType == elem.TEXT_NODE and elem.getAttribute("id").strip():
|
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())
|
obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
|
||||||
if sdfdata[obj.get_id()]:
|
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):
|
def merge_title(self, list, sdfdata, lang, inputfilename):
|
||||||
for elem in list:
|
for elem in list:
|
||||||
obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
|
obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
|
||||||
if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
|
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
|
# L10N tool
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -97,7 +98,7 @@ class Xhtex(AbstractL10nTool):
|
||||||
try:
|
try:
|
||||||
f = open(outputfilename, "w+")
|
f = open(outputfilename, "w+")
|
||||||
str = dom.toxml()
|
str = dom.toxml()
|
||||||
f.write(str)
|
f.write(str.encode("utf-8"))
|
||||||
except IOError:
|
except IOError:
|
||||||
print "ERROR: Can not write file " + outputfilename
|
print "ERROR: Can not write file " + outputfilename
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
Loading…
Reference in a new issue