casual-simulation / casualos

Casual Open Simulation for the Web
https://ab1.bot
MIT License
49 stars 9 forks source link

Support UTF-8 Charset for builds #318

Open KallynGowdy opened 10 months ago

KallynGowdy commented 10 months ago

Currently, we only support ASCII for player builds. This is because we inline the web worker bundle (vm.js) and Vite currently uses atob() and btoa() to encode the script. Unfortunately, atob() and btoa() only support ASCII.

Currently, CasualOS itself has no unicode symbols, but one of our dependencies, lodash does. Normally, this wouldn't be an issue because lodash uses unicode escape sequences (so the lodash source is actually written in ASCII), but ESBuild replaces escape sequences with the actual unicode codepoint to save space.

Our current workaround is to set ESBuild to use ASCII, but this is not ideal.