summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-02-28 20:12:46 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-02-28 20:12:46 +0000
commitf56cde83eb3332123c5fe4362632709e92e31167 (patch)
tree47e6c04576e3d72a34267391d1cc07ae17aba62d
parentMakes selection complexity linear in the number of selected objects instead o... (diff)
downloadinkscape-f56cde83eb3332123c5fe4362632709e92e31167.tar.gz
inkscape-f56cde83eb3332123c5fe4362632709e92e31167.zip
Fix encoding issues with title field in native Windows file save dialog.
We were neither using Unicode versions of the WinAPI function nor properly converting character encodings which resultet in garbled output in the title field in the best case and invalid SVG output in the worst case. Fixed bugs: - https://launchpad.net/bugs/576126 - https://launchpad.net/bugs/1627551 (bzr r15557)
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 02d77cba1..d232a48e4 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -1971,18 +1971,18 @@ UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc(
if(dlgFont) SendMessage(pImpl->_title_edit, WM_SETFONT, (WPARAM)dlgFont, MAKELPARAM(FALSE, 0));
SetWindowPos(pImpl->_title_edit, NULL, rCB1.left-rROOT.left, rCB1.top+ydelta-rROOT.top,
rCB1.right-rCB1.left, rCB1.bottom-rCB1.top, SWP_SHOWWINDOW|SWP_NOZORDER);
- // TODO: make sure this works for Unicode
- SetWindowText(pImpl->_title_edit, pImpl->myDocTitle.c_str());
+ SetWindowTextW(pImpl->_title_edit,
+ (const wchar_t*)g_utf8_to_utf16(pImpl->myDocTitle.c_str(), -1, NULL, NULL, NULL));
}
}
break;
case WM_DESTROY:
{
if(pImpl->_title_edit) {
- int length = GetWindowTextLength(pImpl->_title_edit)+1;
- char* temp_title = new char[length];
- GetWindowText(pImpl->_title_edit, temp_title, length);
- pImpl->myDocTitle = temp_title;
+ int length = GetWindowTextLengthW(pImpl->_title_edit)+1;
+ wchar_t* temp_title = new wchar_t[length];
+ GetWindowTextW(pImpl->_title_edit, temp_title, length);
+ pImpl->myDocTitle = g_utf16_to_utf8((gunichar2*)temp_title, -1, NULL, NULL, NULL);
delete[] temp_title;
DestroyWindow(pImpl->_title_label);
pImpl->_title_label = NULL;