mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Fall back to latin-1 encoding when failed with UTF-8 while parsing manifest
This commit is contained in:
@ -61,8 +61,14 @@ class ManifestFileType(object):
|
||||
class ManifestParserFactory(object):
|
||||
@staticmethod
|
||||
def read_manifest_contents(path):
|
||||
with io.open(path, encoding="utf-8") as fp:
|
||||
return fp.read()
|
||||
last_err = None
|
||||
for encoding in ("utf-8", "latin-1"):
|
||||
try:
|
||||
with io.open(path, encoding=encoding) as fp:
|
||||
return fp.read()
|
||||
except UnicodeDecodeError as e:
|
||||
last_err = e
|
||||
raise last_err
|
||||
|
||||
@classmethod
|
||||
def new_from_file(cls, path, remote_url=False):
|
||||
|
Reference in New Issue
Block a user