Open wellshsu opened 1 year ago
add 'utf8_to_gb' func into commands.cpp
static std::string utf8_to_gb(const char* str) { std::string result; WCHAR* strSrc; LPSTR szRes; int i = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); strSrc = new WCHAR[i + 1]; MultiByteToWideChar(CP_UTF8, 0, str, -1, strSrc, i); i = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL); szRes = new CHAR[i + 1]; WideCharToMultiByte(CP_ACP, 0, strSrc, -1, szRes, i, NULL, NULL); result = szRes; delete[]strSrc; delete[]szRes; return result; }
while (ls_files_stdout->peek() != -1) { std::string mode; std::string object_id; std::string stage; std::string filename; *ls_files_stdout >> mode >> object_id >> stage >> std::ws; std::getline(*ls_files_stdout, filename, '\0'); filename = utf8_to_gb(filename.c_str()).c_str();
while (output.peek() != -1) { std::string tag; std::string object_id; std::string filename; output >> tag; if (tag != "?") { std::string mode; std::string stage; output >> mode >> object_id >> stage; if (!is_git_file_mode(mode)) { continue; } } output >> std::ws; std::getline(output, filename, '\0'); filename = utf8_to_gb(filename.c_str()).c_str();
add 'utf8_to_gb' func into commands.cpp