Skip to content
Browse files

[svn r3880] r4596@delle: sbehnel | 2008-07-09 14:36:17 +0200

 unicode fix

--HG--
branch : trunk
  • Loading branch information...
1 parent ad7d8ab commit b0a032461d3d339b5b2dd51e7851590596644db6 scoder committed Jul 9, 2008
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/lxml/ElementInclude.py
View
10 src/lxml/ElementInclude.py
@@ -96,8 +96,9 @@ def default_loader(href, parse, encoding=None):
data = etree.parse(file).getroot()
else:
data = file.read()
- if encoding:
- data = data.decode(encoding)
+ if not encoding:
+ encoding = 'utf-8'
+ data = data.decode(encoding)
file.close()
return data
@@ -115,8 +116,9 @@ def _lxml_default_loader(href, parse, encoding=None, parser=None):
f = open(href, 'rb')
data = f.read()
f.close()
- if encoding:
- data = data.decode(encoding)
+ if not encoding:
+ encoding = 'utf-8'
+ data = data.decode(encoding)
return data
##

0 comments on commit b0a0324

Please sign in to comment.
Something went wrong with that request. Please try again.