Hello,
I'm facing some weird behaviour when trying to load some files. I'm working in a french windows environment, and when i press the windows + print screen buttons it takes a screenshot and save it as "Capture d’écran (4).png"
Then when I try to load it using the loadFromFile method of the sf::Texture class, it fails. After many test, it seems that the problem is coming from the ’ character, which is different from the usual ' (quote character). And when i replace this character with any other (in the loading code AND in the image name of course), I successfully manage to load the texture.
Is this some kind of bug or am i doing something bad ?
Here is the minimal example code to reproduce my problem :
#include <string>
#include <SFML\Graphics.hpp>
int main(int argc, char* argv[])
{
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML works!");
std::wstring path(L"Capture d’écran.png"); //DOES NOT WORK
//std::wstring path(L"Capture d'écran.png"); //WORKS
sf::String sfPath(path);
sf::Texture texture;
texture.loadFromFile(sfPath);
//texture.loadFromFile("Capture d’écran.png"); //WORKS
sf::Sprite sprite(texture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(sprite);
window.display();
}
return 0;
}
EDIT: in case you are wondering, I HAVE TO use the std::wstring intermediary in my context (converting QString to sf::String)
Thank you