unity-yaml-parser icon indicating copy to clipboard operation
unity-yaml-parser copied to clipboard

fails to load utf-8 scene file

Open danilwhale opened this issue 1 year ago • 1 comments

it just throws error that it cant load it python by default tries to open file in windows-1252, but it fails would be good if UnityDocument.load_yaml would use utf-8 encoding by default

@classmethod
    def load_yaml(cls, file_path):
        register = UnityScalarRegister()
        with open(file_path, newline='', encoding='utf8') as fp:
            data = [d for d in load_all(fp, register)]
            # use document line endings if no mixed lien endings found, else default to linux
            line_endings = UNIX_LINE_ENDINGS if isinstance(fp.newlines, tuple) else fp.newlines
        doc = UnityDocument(data, newline=line_endings, file_path=file_path, register=register)
        return doc

danilwhale avatar Sep 06 '23 07:09 danilwhale

Thanks for the report ! Feel free to open a PR following the contributing guidelines otherwise I'll eventually fix it.

sp-ricard-valverde avatar Sep 12 '23 09:09 sp-ricard-valverde