Skip to content

Commit 836b39a

Browse files
committed
fix encoding as xml
Must be decoded back to a unicode string before being written out.
1 parent 5670994 commit 836b39a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

mpas_analysis/shared/html/pages.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ def generate(self):
185185

186186
outFileName = '{}/index.html'.format(htmlBaseDirectory)
187187

188-
with open(outFileName, 'w') as mainFile:
189-
mainFile.write(pageText.encode('ascii', 'xmlcharrefreplace'))
188+
with open(outFileName, mode='w') as mainFile:
189+
mainFile.write(
190+
pageText.encode('ascii',
191+
'xmlcharrefreplace').decode('ascii'))
190192

191193
# copy the css and js files
192194
fileName = \
@@ -391,8 +393,10 @@ def generate(self):
391393

392394
outFileName = '{}/index.html'.format(self.directory)
393395

394-
with open(outFileName, 'w') as componentFile:
395-
componentFile.write(pageText.encode('ascii', 'xmlcharrefreplace'))
396+
with open(outFileName, mode='w') as componentFile:
397+
componentFile.write(
398+
pageText.encode('ascii',
399+
'xmlcharrefreplace').decode('ascii'))
396400

397401
def get_first_image(self):
398402
"""

0 commit comments

Comments
 (0)