mattgodbolt / seasocks

Simple, small, C++ embeddable webserver with WebSockets support
BSD 2-Clause "Simplified" License
724 stars 120 forks source link

UTF-8 support #188

Open mattgodbolt opened 1 year ago

mattgodbolt commented 1 year ago

Minified javascript files love to use UTF8 in the source,

e.g. a minified version of:

                const latin_convert = {
                    'æ': 'ae',
                    'â±¥': 'a',
                    'ø': 'o',
                    'â„': '/',
                    '∕': '/'
                };

will drop the single-quotes and store the keys as pure æ....which requires the javascript is served as utf-8.

The current type we server "text/javascript" means users get encoding or parse errors. Maybe application/javascript will fix, but other servers will serve it with application/javascript; charset=utf-8 so maybe we need to do proper charset stuff to have this work.