Jump to content

Can't load files with non-latin characters pathes


Go to solution Solved by Josh,

Recommended Posts

Posted

ReadFile is not loading a file, if path contain non-latin (or at least Cirycilic) symbols.

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{

	auto stream = ReadFile("Тест/Test.txt");
	if (!stream) {
		Print("Fail to load");
	} else {
		WString text = stream->ReadString();
		Print(text);
	}
    
    return 0;
}

Тест.zip

Posted

You must specify a wide string:

auto stream = ReadFile(L"Тест/Test.txt");

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

Ah, actually it was AppDir() that failed me in real case. Just found it after a more research. It cut path to non-latin chars.

For example Instead of "D:/Workspace/Тест" it returns "D:/Workspace/"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...