Set encoding for all text reads and writes to utf8, as windows defaults to latin1
This commit is contained in:
@@ -63,7 +63,7 @@ class ConcatFile(TextFile):
|
||||
|
||||
def _doOpenFile(self, filePath):
|
||||
try:
|
||||
self.outFile = open(filePath,mode="wt+")
|
||||
self.outFile = open(filePath,mode="wt+",encoding="utf8")
|
||||
except Exception as e:
|
||||
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
@@ -34,7 +34,7 @@ class HtmlFile(TextFile):
|
||||
|
||||
def _doOpenFile(self, filePath):
|
||||
try:
|
||||
self.outFile = open(filePath,mode="wt+")
|
||||
self.outFile = open(filePath,mode="wt+",encoding="utf8")
|
||||
self.outFile.write("<!DOCTYPE html>\n")
|
||||
self.outFile.write("<html>\n")
|
||||
self.outFile.write("<head>\n")
|
||||
|
||||
@@ -34,7 +34,7 @@ class LaTeXFile(TextFile):
|
||||
def _doOpenFile(self, filePath):
|
||||
|
||||
try:
|
||||
self.outFile = open(filePath,mode="wt+")
|
||||
self.outFile = open(filePath,mode="wt+",encoding="utf8")
|
||||
self.outFile.write("\\documentclass[12pt]{report}\n")
|
||||
self.outFile.write("\\usepackage[utf8]{inputenc}\n")
|
||||
self.outFile.write("\n")
|
||||
|
||||
@@ -34,7 +34,7 @@ class MarkdownFile(TextFile):
|
||||
|
||||
def _doOpenFile(self, filePath):
|
||||
try:
|
||||
self.outFile = open(filePath,mode="wt+")
|
||||
self.outFile = open(filePath,mode="wt+",encoding="utf8")
|
||||
except Exception as e:
|
||||
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
@@ -153,7 +153,7 @@ class TextFile():
|
||||
that uses a different file format that requires a different approach.
|
||||
"""
|
||||
try:
|
||||
self.outFile = open(filePath,mode="wt+")
|
||||
self.outFile = open(filePath,mode="wt+",encoding="utf8")
|
||||
self.outFile.write("\n\n")
|
||||
except Exception as e:
|
||||
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
|
||||
|
||||
Reference in New Issue
Block a user