Encoding error
pigpeer opened this issue · 1 comments
pigpeer commented
srv.set_mount_point("/test", "C:\\测试");
will return true, however, when client query the file, when reading the target file will fail. path
is correct, but wpath
not
inline bool mmap::open(const char* path) {
close();
#if defined(_WIN32)
std::wstring wpath;
for (size_t i = 0; i < strlen(path); i++) {
wpath += path[i];
}
q2a3z commented
Hi, pigpeer.
I think you were used the non-English character in your path.
Because [string -> wstring] Changing that will create garbled characters.
Therefore I recommanded you just use English in your path.
If you rellay want to use Chinese or some non-English character in your path, you can reference this discussion below.
Converting between wstring and string in C++
By the way, If you were used Mac OS or Linux , I thinked that will be OK when you used non-English character.
Because winAPI must uses wstring to their path.