Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sbseltzer opened this issue Jan 10, 2025 · 0 comments
Open

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

sbseltzer opened this issue Jan 10, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@sbseltzer
Copy link
Owner

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.

@sbseltzer sbseltzer added the enhancement New feature or request label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant