3 ms·
Most windows software uses utf16. This guy is used to web and *nix software where UTF-8 is popular. All your strings should default to UTF-16 on Windows so you
by _8j50 3y ago
Most windows software uses utf16. This guy is used to web and *nix software where UTF-8 is popular. All your strings should default to UTF-16 on Windows so you don't have to deal with this against specific APIs.
The longpath thing shouldn't be something you have to deal with each time you call an API. You should do what Git for windows and other software do which is enable long paths (assuming you actually need it) during setup/install.
- n2d4 3y agoA lot of people would disagree with you: >This document also recommends choosing UTF-8 for internal string representation in Windows applications, despite the fact that this standard is less popular there, both due to historical reasons and the lack of native UTF-8 support by the API. We believe that, even on this platform, the following arguments outweigh the lack of native support. https://utf8everywhere.org/ https://utf8everywhere.org/
- jeroenhd 3y agoLinux and MacOS use UTF-8. Qt, Windows itself, Java, Javascript, and (on Windows) C# will all use UTF-16. Most computers run Windows, by a rather big margin. Even more computers use Javascript. Are you running KDE? Don't be surprised if half the text in your screen is secretly UTF-16! UTF-8 is definitely better, but if you're on Windows, you're making your own life harder by using UTF-8. Microsoft is migrating APIs to UTF-8 but it'll take years before that's finished. Just look at all the conversion code you need according to the page you linked. Now, if you're writing a cross platform library, you'll have to decide what encoding(s) you use. I personally don't really see why you wouldn't make your library encoding agnostic, but if you want to stick to one single encoding, you'll have to decide. If you're writing a program for Windows, technical superiority is a mediocre argument for making your own life that much harder. There are tons of formats and design decisions that may be technologically superior, but just end up wasting programmers' time, and this is one of them.
- _8j50 3y agoWindows is not open source, I don't prefer either encoding I am just telling you that as that document acknowledges, UTF-16 is the default whether "everyone" (tech bubble) likes it or not. If you write windows software assume that default, not your favorite utf8. Just like how you assume endianess on a system because of the default.
- DarkmSparks 3y agowhen I first ran into the utf8/utf16 etc a lot of windows stuff was "recommending" utf16. I see quite a few windows text editors default to it. After a day or so of testing and trying it with various different SDKs across different platforms I settled on utf8. did everything needed, compatible with ASCII, all the functionality of 16 none of the _absolute insanity_. looking back, these kind of issues are why its now some 20 years since I wrote any windows software (rather than porting linux/mac stuff or just using cross platform VMs like Javascript, Lua or Java). MFC..... Oh my.... I actually feel sorry for the poor souls that still have that in their life.