1
General / loadFromFile UNICODE path not working
« on: June 17, 2017, 05:27:34 pm »
I am trying to load a file from this path:
C:\Testи\\pic.jpg
using this code (not using code tag, since it destroy the Cyrillic char):
std::string file = u8"C:\\Testи\\UnicodePathCheck\\pic.jpg"; //does not work
sf::Texture tex;
tex.loadFromFile(file) //returns false
It works fine without the Cyrillic character in the path.
Since SFML does not provide a std::wstring overload, I guess it's impossible to load files from paths with characters outside the ASCII range?!
I checked the sources and figured that underlying stb_image library also would need an update to make this work. std::ifstream refuses to load the file. using std::wifstream with std::wstring works
My questions:
C:\Testи\\pic.jpg
using this code (not using code tag, since it destroy the Cyrillic char):
std::string file = u8"C:\\Testи\\UnicodePathCheck\\pic.jpg"; //does not work
sf::Texture tex;
tex.loadFromFile(file) //returns false
It works fine without the Cyrillic character in the path.
Since SFML does not provide a std::wstring overload, I guess it's impossible to load files from paths with characters outside the ASCII range?!
I checked the sources and figured that underlying stb_image library also would need an update to make this work. std::ifstream refuses to load the file. using std::wifstream with std::wstring works
My questions:
- Did I miss something?
- If not, will it be implemented in the future?!
- Maybe this is not an issue at all, since on a (e.g.) Chinese Windows the program files folder is named "program files" anyway. As long as the game and its resources lie in an ASCII based path, it doesn't matter. Or am I wrong (http://www.samlogic.net/articles/program-files-folder-different-languages.htm)