3 ms·
> until Microsoft chooses to enable UTF-8 by default in all of their Windows editions. I don’t know how likely this is. There are a lot of old applications tha
by layer8 2y ago
> until Microsoft chooses to enable UTF-8 by default in all of their Windows editions.
I don’t know how likely this is. There are a lot of old applications that assume a particular code page, or assume 1 byte per character, that this would break. There are also more subtle variations of this, like applications assuming that converting from wide characters to ANSI can’t increase the number of bytes (and hence an existing buffer can be safely reused), which isn’t the case for UTF-8 (but for all, or almost all, existing code pages). It can open up new vulnerabilities.
It would probably cause much less breakage to remove the Best-Fit logic from the win32 xxxA APIs, and instead have all unmappable characters be replaced by a character without any common meta semantics, like “x”.
- kgeist 2y agoMaybe they can introduce OS API versions (if there's no such thing yet) and require new (or updated) apps targetting new API versions/newer SDKs to assume UTF8 by default? So everything below a certain API version is emulated legacy mode. Windows already has the concept of shims to emulate behavior of different Windows versions.
- layer8 2y agoApps can already opt-in to UTF-8 for the ANSI APIs (see https://news.ycombinator.com/item?id=42649122 https://news.ycombinator.com/item?id=42649122), or use the wide-character APIs.
- tambre 2y agoOne example of such an application is Adobe After Effects [0]. Or at least used to be, I no longer use Windows. [0] https://tambre.ee/blog/adobe_after_effects_windows_utf-8/ https://tambre.ee/blog/adobe_after_effects_windows_utf-8/
- cryptonector 2y agoYou already had this problem pre-UTF-8 in Windows: changing your default codepage could cause app fuckiness. So giving the user the option to use UTF-8 is reasonable. Making it the default is also reasonable given the problems that the Best-Fit mapping are causing, though Microsoft would have to do something to help users easily figure out how to run older code. Another not-so-reasonable thing would be to drop all mappings to "special" ASCII characters from the Best-Fit mappings, though this wouldn't help apps linked statically with the CRT. Not so reasonable because it doesn't fix the vulnerabilities. Sometimes security vulnerabilities motivate backwards-compatibility breakage.