Skip to content

Commit

Permalink
fix: incomplete path encoding issue in #1193
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Apr 21, 2024
1 parent 0544104 commit b1c01c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WeaselDeployer/DictManagementDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ LRESULT DictManagementDialog::OnRestore(WORD, WORD code, HWND, BOOL&) {
m_hWnd, open_str, ARRAYSIZE(filter), filter, NULL, L"snapshot");
if (!selected_path.empty()) {
char path[MAX_PATH] = {0};
WideCharToMultiByte(CP_ACP, 0, selected_path.c_str(), -1, path,
WideCharToMultiByte(CP_UTF8, 0, selected_path.c_str(), -1, path,
_countof(path), NULL, NULL);
if (!api_->restore_user_dict(path)) {
MSG_BY_IDS(IDS_STR_ERR_UNKNOWN, IDS_STR_SAD, MB_OK | MB_ICONERROR);
Expand Down Expand Up @@ -197,7 +197,7 @@ LRESULT DictManagementDialog::OnExport(WORD, WORD code, HWND, BOOL&) {
L"txt");
if (!selected_path.empty()) {
char path[MAX_PATH] = {0};
WideCharToMultiByte(CP_ACP, 0, selected_path.c_str(), -1, path,
WideCharToMultiByte(CP_UTF8, 0, selected_path.c_str(), -1, path,
_countof(path), NULL, NULL);
std::string dict_name_str = wstring_to_string(dict_name, CP_UTF8);
int result = api_->export_user_dict(dict_name_str.c_str(), path);
Expand Down Expand Up @@ -247,7 +247,7 @@ LRESULT DictManagementDialog::OnImport(WORD, WORD code, HWND, BOOL&) {
m_hWnd, open_str, ARRAYSIZE(filter), filter, file_name.c_str(), L"txt");
if (!selected_path.empty()) {
char path[MAX_PATH] = {0};
WideCharToMultiByte(CP_ACP, 0, selected_path.c_str(), -1, path,
WideCharToMultiByte(CP_UTF8, 0, selected_path.c_str(), -1, path,
_countof(path), NULL, NULL);
int result = api_->import_user_dict(
wstring_to_string(dict_name, CP_UTF8).c_str(), path);
Expand Down

0 comments on commit b1c01c4

Please sign in to comment.