AGWA / AGWA/git-crypt

Unicode file/dir name bug fix

Đang mở
#292 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
9.9k
Fork
544
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

- 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;
}
```
- modify 'get_encrypted_files' func in commands.cpp
```
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();
```
- modify 'status' func in commands.cpp
```
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();
```
- rebuild binary and done.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.