From 62c8e11a253660294c360787369ecb656e9b67fc Mon Sep 17 00:00:00 2001 From: sje Date: Thu, 11 Oct 2007 07:37:05 +0000 Subject: fix wrong codepage usage git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@361 4f64403b-2f21-0410-a795-97e2b3489a10 --- nohtml/common.h | 1 + nohtml/filter.cpp | 8 ++++---- nohtml/nohtml.cpp | 2 ++ nohtml/version.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nohtml/common.h b/nohtml/common.h index 6d64d27..794a5d9 100644 --- a/nohtml/common.h +++ b/nohtml/common.h @@ -51,6 +51,7 @@ extern HINSTANCE hInst; extern PLUGINLINK *pluginLink; extern DWORD mirandaVer; +extern int codepage; #ifndef MIID_NOHTML #define MIID_NOHTML { 0x9544122C, 0x46DD, 0x4BFA, { 0x8A, 0x5A, 0x5D, 0xDC, 0x3, 0x14, 0x28, 0x93 } } diff --git a/nohtml/filter.cpp b/nohtml/filter.cpp index 4e7839c..951140b 100644 --- a/nohtml/filter.cpp +++ b/nohtml/filter.cpp @@ -58,7 +58,7 @@ int FilterSendMessage(WPARAM wParam, LPARAM lParam) { html_msg = smsg; buf=(char *)malloc(wcslen(html_msg)*3+3); - WideCharToMultiByte( CP_ACP, 0,html_msg, -1,buf,wcslen(html_msg)+1, NULL, NULL); + WideCharToMultiByte( codepage, 0,html_msg, -1,buf,wcslen(html_msg)+1, NULL, NULL); memcpy(&buf[strlen(buf)+1],html_msg,lstrlen(buf)*2+2); delete[] html_msg; } else { @@ -124,8 +124,8 @@ int FilterRecvMessage(WPARAM wParam, LPARAM lParam) { //delete[] pre->szMessage; not necessary - done in server.cpp buf=(char *)malloc(wcslen(st_wbuf)*3+3); - WideCharToMultiByte( CP_ACP, 0,st_wbuf, -1,buf,wcslen(st_wbuf)+1, NULL, NULL); - memcpy(&buf[strlen(buf)+1],st_wbuf,lstrlen(buf)*2+2); + WideCharToMultiByte(CP_UTF8, 0, st_wbuf, -1,buf,wcslen(st_wbuf)+1, NULL, NULL); + memcpy(&buf[strlen(buf)+1], st_wbuf, lstrlen(buf)*2+2); delete[] st_wbuf; pre->szMessage = buf; } else if(pre->flags & PREF_UNICODE) { @@ -148,7 +148,7 @@ int FilterRecvMessage(WPARAM wParam, LPARAM lParam) { } //delete[] pre->szMessage; not necessary - done in server.cpp buf=(char *)malloc(wcslen(st_wbuf)*3+3); - WideCharToMultiByte( CP_ACP, 0,st_wbuf, -1,buf,wcslen(st_wbuf)+1, NULL, NULL); + WideCharToMultiByte(codepage, 0, st_wbuf, -1,buf,wcslen(st_wbuf)+1, NULL, NULL); memcpy(&buf[strlen(buf)+1],st_wbuf,lstrlen(buf)*2+2); delete[] st_wbuf; pre->szMessage = buf; diff --git a/nohtml/nohtml.cpp b/nohtml/nohtml.cpp index 1bb84fb..9bc7c32 100644 --- a/nohtml/nohtml.cpp +++ b/nohtml/nohtml.cpp @@ -11,6 +11,7 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; DWORD mirandaVer; +int codepage; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), @@ -95,6 +96,7 @@ HANDLE hModulesLoaded; extern "C" __declspec (dllexport) int Load(PLUGINLINK *link) { pluginLink=link; + codepage = (int)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); InitOptions(); ///////////// diff --git a/nohtml/version.h b/nohtml/version.h index 50b4784..44d117d 100644 --- a/nohtml/version.h +++ b/nohtml/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 0 #define __RELEASE_NUM 2 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -- cgit v1.2.3