Getwritablepath's character problem

Getwritablepath's character problem

            string      fileData    = FileUtils::getInstance()->getWritablePath() + "setting.dat";
            FILE*		pFile		= fopen(fileData.c_str(), "r");

I using getWritablePath like this.
but on windows, if computer’s username is not alphabat, like japanese, chinese, korean, pFile is NULL
because of string’s character is broken.
how can I fix this problem?
I saved this code by signed utf-8(code 65001).


Use cocos API to read file:



problem is getWritablePath’s return string is broken.
if username is ユーザー (=korean), getWritablePath’s return is ‘Invalid character in string’
because of username is not english.


Why do you think it’s invalid?
It should be in UTF-8.


getWritablePath’s return value is
but “1강의실-28번”(korean) is broken data, so return is invalied value(value is ???) like this screenshot.
and my code is saved by signed utf-8(code 65001).
and i using #pragma execution_character_set(“UTF-8”) too.


It should be valid.
You can’t see it just by chars in buffer because UTF-8 format is more complex.
One non-english character in UTF-8 can be 2 or 3 bytes in size.
To see real string you need to convert it to Unicode.