gazebosim / gz-common

An audio-visual library supports processing audio and video files, a graphics library can load a variety 3D mesh file formats into a generic in-memory representation, and the core library of Gazebo Common contains functionality that spans Base64 encoding/decoding to thread pools.
https://gazebosim.org
Apache License 2.0
14 stars 39 forks source link

Use UTF16 versions of Windows API functions #129

Open peci1 opened 3 years ago

peci1 commented 3 years ago

Most of ign-common is using the ASCII versions of Windows API functions. These should be converted to the ones using wchar_t (UTF16) strings. The ASCII API is prone to text encoding problems, whereas the UTF16 API doesn't have an issue.

This would probably also deserve a helper function to convert std::string<char> to std::wstring (std::string<wchar_t>). https://stackoverflow.com/questions/4804298/how-to-convert-wstring-into-string might be a good start for this function, as it really isn't as trivial as one would think.

peci1 commented 3 years ago

A part of the usages can be completely eliminated by switching to C++17 filesystem library. The main blocker would probably be XCode 10, which does not support filesystem (although it supports a big part of C++17, filesystem is not there - https://developer.apple.com/documentation/xcode-release-notes/xcode-11-release-notes#New-Features ).