fix:编码修正。

This commit is contained in:
taynpg 2024-12-17 09:34:37 +08:00
parent 8b23f75383
commit 834b77d74e

View File

@ -133,7 +133,7 @@ bool CClient::cancel_task()
bool CClient::down_one_file(const std::string& id, const std::string& file) bool CClient::down_one_file(const std::string& id, const std::string& file)
{ {
down_->cur_remote_id_ = id; down_->cur_remote_id_ = id;
down_->cur_remote_file_ = file; down_->cur_remote_file_ = CCodec::u8ToGBK(file);
fs::path remote_file(ofen::COfPath::normalize(down_->cur_remote_file_)); fs::path remote_file(ofen::COfPath::normalize(down_->cur_remote_file_));
down_->cur_file_ = COfPath::to_full(remote_file.filename().string()); down_->cur_file_ = COfPath::to_full(remote_file.filename().string());
@ -220,12 +220,8 @@ void CClient::handle_frame(CFrameBuffer* buf)
if (real.empty()) { if (real.empty()) {
continue; continue;
} }
#ifdef _WIN32
real = CCodec::u8ToGBK(real);
#endif
if (real.find("[") == std::string::npos) { if (real.find("[") == std::string::npos) {
logger_->info("FILE ==> {}", real); logger_->info("FILE ==> {}", CCodec::u8ToGBK(real));
task_list_[index]->files.push_back(real); task_list_[index]->files.push_back(real);
} else { } else {
auto a = real.find_first_of("[") + 1; auto a = real.find_first_of("[") + 1;
@ -274,7 +270,11 @@ void CClient::handle_frame(CFrameBuffer* buf)
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
up_[buf->fid_] = std::make_shared<TransInfomation>(); up_[buf->fid_] = std::make_shared<TransInfomation>();
t = up_[buf->fid_]; t = up_[buf->fid_];
#ifdef _WIN32
t->cur_file_ = CCodec::u8ToGBK(std::string(buf->data_, buf->len_));
#else
t->cur_file_ = std::string(buf->data_, buf->len_); t->cur_file_ = std::string(buf->data_, buf->len_);
#endif
t->file_ = fopen(t->cur_file_.c_str(), "rb"); t->file_ = fopen(t->cur_file_.c_str(), "rb");
} else { } else {
t = down_; t = down_;