3 ms·
Unfortunately there are still cases where the A API has bugs that the W API lacks, see e.g: https://stackoverflow.com/q/67427569 https://stackoverflow.com/q/674
by skissane 3y ago
Unfortunately there are still cases where the A API has bugs that the W API lacks, see e.g: https://stackoverflow.com/q/67427569 https://stackoverflow.com/q/67427569
Also, some APIs use buffers with a fixed maximum size, and the A API's buffer isn't big enough to handle the maximum possible data size for the W API.
And some APIs are Unicode-only, and don't have A versions.
For maximum reliability, better to use W APIs only and do the UTF-8<->UTF-16 conversion yourself.
However, in practice, if you just use A APIs only and let Windows do the UTF-8 conversion for you, it is going to work 95% of the time. But maybe at some point you'll hit that 5% where it doesn't. It is more likely if you are using more obscure APIs (like my example at the start of manipulating Windows Terminal Server sessions). More likely for system-level stuff than application-level.
- account42 3y ago> For maximum reliability, better to use W APIs only and do the UTF-8<->UTF-16 conversion yourself. You mean the WTF-8<->WTF-16 conversion. https://simonsapin.github.io/wtf-8/ https://simonsapin.github.io/wtf-8/