Skip to content

Attempt to auto-detect codec for source files in Prebuild.py #15

Open
@sbseltzer

Description

@sbseltzer

At the moment, decoding of source files does not handle exceptions. I added codec settings to PrebuildConfig.py to mitigate this, but I'd much rather users don't have to mess with that.

This stack thread has some options: https://stackoverflow.com/questions/436220/how-to-determine-the-encoding-of-text

I'd like to avoid any nonstandard Python dependencies, so magic and chardet are off the table.

This answer, albeit brute-force, looks promising: https://stackoverflow.com/a/68701302/6272829

I think the list it checks should probably be smaller and in an order of likelihood that's more characteristic of UE code projects.

It'd probably be safe to determine codec for the first source file that's encountered and just assume it'll be the same for all proceeding source files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions