This script checks to see what characters need to be escaped in a data URL (in addition to % for percent-encoded hexadecimal escapes) for a browser to parse it correctly. This information is used to implement esbuild's dataurl loader. Here is what your current browser requires:


The answer that works across Chrome, Firefox, and Safari appears to be:

Always percent-encode these values: 0x09, 0x0A, 0x0D, 0x23
Only percent-encode these values in the trailing position: 0x00 to 0x08, 0x0B, 0x0C, 0x0E to 0x20