8023: HTML view fails to load
support both py2 and py3 with non-ascii chars
This commit is contained in:
parent
d9cc3d3b0e
commit
f63385ac4b
@ -30,7 +30,7 @@ Can use the Webkit or Gecko ( Mozilla ) library
|
|||||||
# Python modules
|
# Python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os, io
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
from urlparse import urlunsplit
|
from urlparse import urlunsplit
|
||||||
@ -557,7 +557,7 @@ class HtmlView(NavigationView):
|
|||||||
# Now we have two views : Web and Geography, we need to create the
|
# Now we have two views : Web and Geography, we need to create the
|
||||||
# startpage only once.
|
# startpage only once.
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
ufd = open(filename, "w+")
|
ufd = io.open(filename, "w+", encoding="utf8")
|
||||||
ufd.write(data)
|
ufd.write(data)
|
||||||
ufd.close()
|
ufd.close()
|
||||||
return urlunsplit(('file', '',
|
return urlunsplit(('file', '',
|
||||||
|
Loading…
Reference in New Issue
Block a user