Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions addons/source-python/packages/source-python/config/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ConfigManager(object):
"""Config Management class used to create a config file."""

def __init__(
self, filepath, cvar_prefix='', indention=3, max_line_length=79):
self, filepath, cvar_prefix='', indention=3, max_line_length=79, encoding='utf-8'):
"""Initialized the configuration manager.

:param str filepath:
Expand All @@ -75,6 +75,7 @@ def __init__(
self._cvar_prefix = cvar_prefix
self._indention = indention
self._max_line_length = max_line_length
self._encoding = encoding

# Store the header and separator
self.header = ''
Expand Down Expand Up @@ -263,7 +264,7 @@ def write(self):
self.fullpath.parent.makedirs()

# Open/close the file to write to it
with self.fullpath.open('w') as open_file:
with self.fullpath.open('w', encoding=self._encoding) as open_file:

# Get the number of spaces to indent after //
spaces = ' ' * (self.indention - 2)
Expand Down Expand Up @@ -329,7 +330,7 @@ def execute(self):
self.fullpath))

# Open/close the file
with self.fullpath.open() as open_file:
with self.fullpath.open(encoding=self._encoding) as open_file:

# Loop through all lines in the file
for line in open_file.readlines():
Expand Down Expand Up @@ -385,7 +386,7 @@ def _parse_old_file(self):
return _old_config

# Open/close the file
with self.fullpath.open() as open_file:
with self.fullpath.open(encoding=self._encoding) as open_file:

# Get all lines from the file
_all_lines = [line.strip() for line in open_file.readlines()]
Expand Down