Traditional and Simplified Chinese convert under emacs

This is a complicated story, as you know I love traditional Chinese characters. Meanwhile, I write in traditional Chinese and the input method I selected Canji and also wrote the emacs package for it.
I always type traditional Chinese in emacs, all my going-to-publish articles are in traditional Chinese. I mail the articles to the editor, she will do the convert.
But recently, I need do post some simplified articles by myself, I have to find some sufficient way to do it, instead open a web page copy, paste, convert, then copy again and paste again. It waste time!
First of all, my emacs configuration is put on google drive, and all my Windows, MacOS and Linux computers all symbol link to the same .emacs and same .emacs.d file on google, then I can use the same emacs without do any modification.
Here is the way using emacs to do the Chinese characters convert, I spent hours to figure it out, but I will make it easy and clear.
1. Download unicad from https://code.google.com/archive/p/unicad/downloads
2. Extract and put unicad.el under ~/.emacs.d/site-lisp, normally this folder is already in the path, you don’t have to do anything
3. Add following to .emacs

(add-to-list 'load-path "~/.emacs.d/site-lisp") ;normally this one is already at the beginning of your .emacs
(require 'unicad)

4. Tongwen emacs package, go to the directory ~/.emacs.d/site-lisp, type:

git clone https://github.com/monkey413/tongwen-emacs.git

git clone will create a folder called tongwen-emacs
5. Add hanconvert(tongwen) to .emacs

(add-to-list 'load-path "~/.emacs.d/site-lisp/tongwen-emacs") 
(require 'hanconvert)

6. hanconvert rely on chardet module for python, easy:

sudo pip install chardet

7. Done

m-x hanconvrt-to

Up to now, it works perfectly on Ubuntu, but not for MacOS, because my Mac has too many versions of python, I need do some clean up and make emacs inherit the environment from the shell.

Leave a Reply

Your email address will not be published. Required fields are marked *