[新版无需补丁]wine中文乱码补丁解决尝试

Wine、Cedega、CrossOver 等配置
回复
liuyc
帖子: 40
注册时间: 2012-07-25 10:49
送出感谢: 0
接收感谢: 0

[新版无需补丁]wine中文乱码补丁解决尝试

#1

帖子 liuyc » 2013-03-01 13:03

见5楼

wine中文乱码补丁尝试
==========

freetype.c
freetype.c.xz
(49.05 KiB) 下载 57 次
gdi32.dll.so
gdi32.dll.so.xz
(756.02 KiB) 下载 47 次
==========
水平有限,望多多指教
欢迎提供更好的方法
==========
有些程序使用 lf.lfCharSet=0 lf.lfCharSet=1 ...造成乱码,之前见过论坛里补丁对lf.lfCharSet=0(ANSI_CHARSET)有效,对1,...无效。
==========
改dlls/gdi32/freetype.c中

代码: 全选

       if(!TranslateCharsetInfo((DWORD*)(INT_PTR)lf.lfCharSet, &csi, TCI_SRCCHARSET)) {
            switch(lf.lfCharSet) {
        	case DEFAULT_CHARSET:
           	    csi.fs.fsCsb[0] = 0;
        	    break;
        	default:
	            FIXME("Untranslated charset %d\n", lf.lfCharSet);
	            csi.fs.fsCsb[0] = 0;
	            break;
	    }
        }

代码: 全选

/* WINE_CUSTOM_CHARSET PATCH 0.2 wine_1.5.24 liuyc BEGIN */
/*README

 * ENVIRONMENT VARIABLES
    WINE_FORCE_CODEPAGE : 0:disable 1:GetACP others:directly set codepage
    or
    WINE_CUSTOM_CODEPAGE : 1:enable
    WINE_CHARSET_XXXX : 0:disable 1:GetACP others:directly set codepage (XXXX = 0,1,2,3,...)

 *REFERENCES http://www.winehq.org/pipermail/wine-patches/attachments/20081203/b4b7e84f/attachment-0001.pdf 

 * LICENSE
 *the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. 
 *This patch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
*/

    UINT forcecodepage = 0;
    UINT customcodepage = 0;
    char *env_wfdc = getenv("WINE_FORCE_CODEPAGE");
    char *env_wcdc = getenv("WINE_CUSTOM_CODEPAGE");
    if(env_wfdc != NULL) forcecodepage = atoi(env_wfdc);
    if(env_wcdc != NULL) customcodepage = atoi(env_wcdc);
    if (forcecodepage != 0) {
        if (forcecodepage == 1) {
            forcecodepage = GetACP();
            FIXME("WINE_FORCE_CODEPAGE == 1, lf.lfCharSet == %d, using GetACP (%d)\n",lf.lfCharSet,forcecodepage); 
        } else FIXME("WINE_FORCE_CODEPAGE == %d, overriding lfCharSet(%d)\n",forcecodepage,lf.lfCharSet);
        if(!TranslateCharsetInfo((DWORD*)(INT_PTR)forcecodepage, &csi,TCI_SRCCODEPAGE)) {
            FIXME("OMG. Even this hack doesn't work. Let's PRAY.\n");
            csi.fs.fsCsb[0] = 0;
        }
        lf.lfCharSet = csi.ciCharset;
    } else {
       if (customcodepage == 1) {
           UINT codepage = 0;
           //char *env_wedc = (char *)malloc(18*sizeof(char));
           char *env_wedc;
           //memset(env_wedc,0,sizeof(env_wedc));
           //sprintf(env_wedc,"WINE_CHARSET_%.4d",lf.lfCharSet);
           
           asprintf(&env_wedc,"WINE_CHARSET_%d",lf.lfCharSet);
           FIXME("%s\n",env_wedc);
           char *env_wdc = getenv(env_wedc);
           if(env_wdc != NULL) codepage = atoi(env_wdc);
           if (codepage != 0) {
                if (codepage == 1) {
                    codepage = GetACP();
                    FIXME("%s == 1, using GetACP (%d)\n",env_wedc,codepage);
                } else FIXME("%s == %d, overriding lfCharSet\n",env_wedc,codepage);
                if(!TranslateCharsetInfo((DWORD*)(INT_PTR)codepage, &csi,TCI_SRCCODEPAGE)) {
                    FIXME("OMG. Even this hack doesn't work. Let's PRAY.\n");
                    csi.fs.fsCsb[0] = 0;
                }
                lf.lfCharSet = csi.ciCharset;
           } else if(!TranslateCharsetInfo((DWORD*)(INT_PTR)lf.lfCharSet, &csi, TCI_SRCCHARSET)) {
               switch(lf.lfCharSet) {
                   case DEFAULT_CHARSET:
                       csi.fs.fsCsb[0] = 0;
                       break;
                   default:
	               FIXME("Untranslated charset %d\n", lf.lfCharSet);
	               csi.fs.fsCsb[0] = 0;
	               break;
	       }
             }
           //free(env_wedc);
       } else if(!TranslateCharsetInfo((DWORD*)(INT_PTR)lf.lfCharSet, &csi, TCI_SRCCHARSET)) {
            switch(lf.lfCharSet) {
        	case DEFAULT_CHARSET:
           	    csi.fs.fsCsb[0] = 0;
        	    break;
        	default:
	            FIXME("Untranslated charset %d\n", lf.lfCharSet);
	            csi.fs.fsCsb[0] = 0;
	            break;
	    }
        }
    }
    // WINE_CUSTOM_CHARSET PATCH 0.2 wine_1.5.24 liuyc END
上次由 liuyc 在 2013-05-18 0:05,总共编辑 2 次。
本论坛注册登陆有问题? 删cookie

http://liuycme.tk-----MyWebsite
头像
fuhaoyun
帖子: 526
注册时间: 2009-05-08 14:12
来自: http://weibo.com/u/2201287863
送出感谢: 2 次
接收感谢: 4 次

Re: wine中文乱码补丁解决尝试

#2

帖子 fuhaoyun » 2013-03-02 20:23

测试一下,看看通达信还有没有部分乱码

只用Ubuntu/Unity:安全、高效、自由、简洁!
http://weibo.com/u/2201287863
----------------------------------------------------
用了4年Ubuntu,发现离开windows也可以活得很好
看球赛、炒股、聊天、office等等都不算问题了
一切都是习惯,困难解决了就好

头像
fuhaoyun
帖子: 526
注册时间: 2009-05-08 14:12
来自: http://weibo.com/u/2201287863
送出感谢: 2 次
接收感谢: 4 次

Re: wine中文乱码补丁解决尝试

#3

帖子 fuhaoyun » 2013-03-03 21:46

tdx.png
我将gdi32.dll.so.xzj解压后替换/usr/lib/i386-linux-gnu/wine/gdi32.dll.so,还是乱码
freetype.c不知道怎么用

只用Ubuntu/Unity:安全、高效、自由、简洁!
http://weibo.com/u/2201287863
----------------------------------------------------
用了4年Ubuntu,发现离开windows也可以活得很好
看球赛、炒股、聊天、office等等都不算问题了
一切都是习惯,困难解决了就好

头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙
送出感谢: 4 次
接收感谢: 256 次

Re: wine中文乱码补丁解决尝试

#4

帖子 eexpress » 2013-03-03 21:48

改那假注册表的字体就是。没见过要打补丁的。这2句,能兼容多少编码。。。
● 鸣学
liuyc
帖子: 40
注册时间: 2012-07-25 10:49
送出感谢: 0
接收感谢: 0

Re: [新版无需补丁]wine中文乱码补丁解决尝试

#5

帖子 liuyc » 2013-05-18 0:06

本论坛注册登陆有问题? 删cookie

http://liuycme.tk-----MyWebsite
回复

回到 “Wine及其分支”