Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadTexture with path containing special characters not working #172

Closed
SebLague opened this issue Jul 23, 2023 · 3 comments · Fixed by #173
Closed

LoadTexture with path containing special characters not working #172

SebLague opened this issue Jul 23, 2023 · 3 comments · Fixed by #173

Comments

@SebLague
Copy link

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.

@anggape
Copy link
Contributor

anggape commented Jul 24, 2023

what error printed to the console?

@anggape
Copy link
Contributor

anggape commented Jul 24, 2023

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))

@SebLague
Copy link
Author

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

9ParsonsB added a commit that referenced this issue Jul 24, 2023
rather then StringToCoTaskMemUTF8
tested on Windows 11 (x64) & Arch Linux (x64)
should fix #172
chrisdill pushed a commit that referenced this issue Jul 24, 2023
Rather then StringToCoTaskMemUTF8.
Tested on Windows 11 (x64) & Arch Linux (x64).
Should fix #172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants