diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-25 16:02:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-25 16:02:12 +0000 |
commit | 70598a51f5bd62c1d342eaab4ee3641068b58455 (patch) | |
tree | 3384e2f7753ef1e48d3241999ff8331e26134ebb /src | |
parent | a75c230f0b36bc16a2d36e4321ebbdb82a25cc9b (diff) |
fix for displaying ansi chars in Options - Languages
git-svn-id: http://svn.miranda-ng.org/main/trunk@8742 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/langpack.cpp | 2 | ||||
-rw-r--r-- | src/modules/langpack/lpopts.cpp | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 6936fbda76..c6911ea135 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -306,7 +306,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start fgets(line, LANGPACK_BUF_SIZE, fp);
size_t lineLen = strlen(line);
if (lineLen >= 3 && line[0] == '\xef' && line[1] == '\xbb' && line[2] == '\xbf') {
- fileCp = CP_UTF8;
+ lpinfo.codepage = fileCp = CP_UTF8;
memmove(line, line + 3, lineLen - 2);
}
diff --git a/src/modules/langpack/lpopts.cpp b/src/modules/langpack/lpopts.cpp index 376f74fcc9..440d22bf7b 100644 --- a/src/modules/langpack/lpopts.cpp +++ b/src/modules/langpack/lpopts.cpp @@ -25,6 +25,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "langpack.h"
+static void SetDlgItemText_CP(HWND hwndDlg, int ctrlID, int codepage, LPCSTR str)
+{
+ int cbSize = MultiByteToWideChar(codepage, 0, str, -1, NULL, 0);
+ WCHAR *wszBuf = (WCHAR*)_alloca(sizeof(WCHAR)*(cbSize + 1));
+ MultiByteToWideChar(codepage, 0, str, -1, wszBuf, cbSize);
+ wszBuf[cbSize] = 0;
+ SetDlgItemTextW(hwndDlg, ctrlID, wszBuf);
+}
+
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
{
/* locale string */
@@ -59,7 +68,7 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate);
/* plugins included */
- SetDlgItemTextA(hwndDlg, IDC_PLUGINSINCLUDED, pack->szPluginsIncluded);
+ SetDlgItemText_CP(hwndDlg, IDC_PLUGINSINCLUDED, pack->codepage, pack->szPluginsIncluded);
if (pack->szPluginsIncluded[0]) {
if (!IsWindowVisible(GetDlgItem(hwndDlg, IDC_PLUGINSINCLUDEDLABEL))) {
ShowWindow(GetDlgItem(hwndDlg,IDC_PLUGINSINCLUDEDLABEL), SW_SHOW);
@@ -72,9 +81,9 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) }
/* general */
- SetDlgItemTextA(hwndDlg, IDC_LANGMODUSING, pack->szLastModifiedUsing);
- SetDlgItemTextA(hwndDlg, IDC_LANGAUTHORS, pack->szAuthors);
- SetDlgItemTextA(hwndDlg, IDC_LANGEMAIL, pack->szAuthorEmail);
+ SetDlgItemText_CP(hwndDlg, IDC_LANGMODUSING, pack->codepage, pack->szLastModifiedUsing);
+ SetDlgItemText_CP(hwndDlg, IDC_LANGAUTHORS, pack->codepage, pack->szAuthors);
+ SetDlgItemText_CP(hwndDlg, IDC_LANGEMAIL, pack->codepage, pack->szAuthorEmail);
SetDlgItemText(hwndDlg, IDC_LANGINFOFRAME, TranslateTS(pack->tszLanguage));
}
|