Ashley Gullen Profile picture
Founder of Scirra and lead developer of @ConstructTeam. Please don't tweet me for tech support/bugs, post to forum instead! Also on Mastodon and Bluesky
Sep 22, 2023 6 tweets 2 min read
If you thought JavaScript was a mess, here's what it takes to pass a file path to a Windows API in C++: 🧵
- Windows uses UTF-16, but most modern software uses UTF-8
- Converting UTF-8 to UTF-16 requires calling MultiByteToWideChar twice (once for size, second to convert)
(1/5) - Alternatively you can set the process code page to UTF-8 and call the 'A' variant API directly, but only sometimes, and only with Windows 10 v1903+, and you might still have to change the system locale setting and reboot
- Now you can pass a file path! But...
(2/5)