解决Mac使用wine安装的软件中文显示成方块的问题

毫无疑问Mac的体验相较于Windows有质的区别。由于,平台的差异导致很多软件不兼容,尤其是使用某个平台的特定API的软件,比如本文用到的notepad++,导致很难迁移。

Wine

这是一个在非Windows平台运行Windows软件成为可能的软件。
这是一个开源的软件,在其基础上有很多包装了Wine的软件,比如Crossover,这也是wine官方推荐的,这是收费的。
wine好像不翻墙的话,不好下载,附上自己的百度云:链接:https://pan.baidu.com/s/1vUX8eYVx5TGIDSbJMG3WzQ 密码:qp43

问题描述

自己的MAC的语言设置为英文,安装完毕wine,如下图:
在这里插入图片描述

打开之后如下:
在这里插入图片描述

提示符告知了如何安装windows的软件,包括exe和msi格式。
鄙人主要是为了使用几乎离不开的notepad++软件(32位版本即可,因为64位很多插件不兼容),虽然Mac平台也有其很好用的编辑器软件,比如BBEdit(收费)、UltraEdit(收费)、TextWrangler(收费)。但个人总觉得相较于notepad++体验差很多。用来查看log很方便。

# 使用如下命令安装notepad++软件
wine ~/Downloads/npp.7.8.1.Installer.exe

安装完毕之后,直接启动这个软件,下次启动的时候,用如下命令即可。

wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe

由于我的电脑本地的语言环境是英文,默认安装notepad++的话,默认语言环境就是英文,当然可以在安装的时候就选择中文,也可以选择英文,在安装选项的时候,在本地化选项打勾,然后在进入软件的时候切换Notepad++的语言,
在这里插入图片描述

诡异的问题来了,打进去的中文如下:

在这里插入图片描述
在这里插入图片描述

即,中文变成了小方块,很奇怪。因为,软件本身的菜单栏之类的中文显示都是正常的。

先说解决办法,启动软件的时候用如下命令即可:

先声明一下网上诸多的修改注册表的方法,亲自实验并不可用。

  1. 首先查看你下自己的Mac支持的locale
locale -a | grep zh

我自己的输出如下:
在这里插入图片描述
一般选择zh_CN.UTF-8即可

  1. 拷贝字体
    wine里面没有相关的中文字体,可以直接从Windows拷贝过来,在C:/windows/fonts下边的所有汉字拷贝到~/.wine/drive_c/windows/Fonts目录下。或许这一步不是必须,没有实验。我拷贝了如下4种字体:

simfang.ttf simhei.ttf simkai.ttf simsun.ttc

  1. 使用设置的LC_ALL启动Windows软件
LC_ALL=zh_CN.UTF-8 wine .wine/drive_c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe

如果不能解决,也可以在安装notepad++软件的时候指定LC_ALL环境变量,command like below:

LC_ALL=zh_CN.UTF-8 wine ~/Downloads/npp.7.8.1.Installer.exe

但是在下次启动的时候,仍然需要使用带LC_ALL环境变量的命令。

解释

原因在于,本地化语言环境不对,正如下边链接解释(这是我百度谷歌无数次最有用的解释了,忘记那些网上的修正注册表的博客吧,无用。):

https://www.winehq.org/pipermail/wine-users/2006-June/022062.html
这是邮件,国内不翻墙好像不容易加载,贴下边:

[Wine] Chinese fonts not displayed properly
Wei-Tsun Sun wsun013.wine at gmail.com
Tue Jun 6 08:53:56 CDT 2006
Previous message: [Wine] Chinese fonts not displayed properly
Next message: [Wine] Re: Chinese fonts not displayed properly
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 4 Jun 2006 22:39:09 +1200
Raimund Eimann <raimund at cs.auckland.ac.nz> wrote:

> Hi,
> 
> I've got Chinese Windows application that appears to have a problem with 
> Chinese fonts under wine (emulating Windows 98). It's available from here: 
> http://www.gtjadzh.com/ (download starts automatically after some seconds, 
> filename is setup_dzh5_fuyi.exe. When running "wine setup_dzh5_fuyi.exe" from 
> a console, I get get to see a window full of garbage characters (see 
> attachment), although I successfully installed Microsoft's Input Method 
> Editors (Chinese language pack, filename: scmondo.exe) from  
> 
> http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=803A623E-C311-4591-A593-B0E24A6F38E8
> 
> If anyone could give me a hint about what to do, that would be great, 
> otherwise I'll have to install an entire Windows system just for this single 
> program :(
> 
> Thanks,
> Raimund
> 
> 
> Today's wisdom:
> An error?  Impossible!  My modem is error correcting.

Hi,

This is related to the locale settings that you have. Even though you have chinese fonts installed in either linux fonts relevant 
directory (say /usr/share/fonts) or in the font dir within wine (~/.wine/..../fonts), you will still need to set the locale correctly
in order to show chinese fonts in some applications. The attachments are two examples of different locale which leads the display
in totally different outcomes. To run this program correctly, you can specified the locale setting for the intended app, in this case

LC_ALL=zh_CN wine setup_dzh5_fuyi.exe

http://wsun013.googlepages.com/locale-cn.png
http://wsun013.googlepages.com/locale-us.png
hope this helps you,

Wei-Tsun Sun

--------------------------------------------------------
University of Auckland
Electrical and Computer Engineering
--------------------------------------------------------

Previous message: [Wine] Chinese fonts not displayed properly
Next message: [Wine] Re: Chinese fonts not displayed properly
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the wine-users mailing list

虚拟机

  • 当然这是除了使用wine之外的一个选择,相较于虚拟机,wine相较于虚拟机优点亦不言自明,不用为了使用一个Windows软件而特意启动一个Windows系统,那样会造成宿主系统资源不必要的浪费。这种类型的软件包括virtualBox(free),以及vmware(non-free)。
  • 还有一个Mac平台特有的虚拟机软件Parallels Desktop,但是收费。当然网上有大把破解版的。其使用体验比Virtual box好许多。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章