5 ms·
JavaScript is called the entire "web" now? HTML and CSS work with UTF-8 just fine and the majority of the WWW uses UTF-8 to serve them.
by zodiakzz 5y ago
JavaScript is called the entire "web" now? HTML and CSS work with UTF-8 just fine and the majority of the WWW uses UTF-8 to serve them.
- paulddraper 5y agoI think you know the poster is taking about programming languages, where the bulk of complexity lies.
- trusktr 5y agoYes, but WebAssembly operates at the boundary with JS, and that is not UTF-8. JS uses WTF-16 at runtime, and if WebAssembly did too then this would make interop between Wasm and JS a first-class feature with maximal performance and without security and data integrity issues.
- kevingadd 5y agoThe canonical representation of DOM content is DOMString (https://developer.mozilla.org/en-US/docs/Web/API/DOMString https://developer.mozilla.org/en-US/docs/Web/API/DOMString), which is not UTF-8. Your HTML being encoded in UTF-8 is irrelevant, it gets decoded when it's loaded into whatever the canonical representation is. Your HTML could be in Shift-JIS or ASCII or whatever and not UTF-8, same difference.
- trusktr 5y agoThis is exactly right. UTF-8 is the transmission format that your HTML gets sent in, but it is not the format of strings in JavaScript at runtime. The problem being discussed is about runtime interoperability between JS (with WTF-16 string format) and WebAssembly.