解決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好許多。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章