chrisdill / raylib-cs

C# bindings for raylib, a simple and easy-to-use library to learn videogames programming

Home Page:http://www.raylib.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LoadTexture with path containing special characters not working

SebLague opened this issue · comments

Hi, thanks for the great bindings! I'm currently running into an issue trying to load a texture when the path contains special characters such as 'ã'.
Here is my test code:

string path = "C:\\Users\\sebas\\Desktop\\chãrtest\\Pieces.png";
piecesTexture = Raylib.LoadTexture(path);

This works fine if the path does not contain the special character. Am I doing something wrong, or is there any work-around for this?
Using windows 10 and latest version of raylib/raylib-cs.

commented

what error printed to the console?

commented

after trying to reproduce this bugs,
seems like raylib cant handle utf8 characters on windows, here how raylib-cs convert c# string to c char* , file will load properly if you replace StringToCoTaskMemUTF8 with StringToHGlobalAnsi but you will get AccessViolationException, for now you can replace LoadTexture with Raylib.LoadTextureFromImage(Raylib.LoadImageFromMemory(".png", FILE_BYTES))

Thank you @anggape LoadImageFromMemory seems to have done the trick!