Issues with Fcitx-Sougou for Chinese input in Emacs

Posted by:

Fcitx to input Chinese in Emacs

This should only be used in some case, including emacs and java. Emacs has ahistorical bug, that under en_US.UTF-8 or similar locale, it will never use XIM (Though emacs is a gtk app, it use XIM). The only way to walkaround this is to use LC_CTYPE to fix this.

This was one of most obnoxious problems. With installation of my favorite Sougou(搜狗) IME, I can input Chinese in any application (even in Terminal) with Sougou but emacs. After banging my head on this issue for a long time, following is what I have figured out, and yes, it is working fine now.

Following are some notes while I was doing the debugging. Hope it will help some souls out there.

  1. First, testing Emacs without any customization.

    works fine with C-~ to switch and input with Fcitx, which means it works fine without any customization of Emacs.

  2. However,when Emacs started with -q no-site-file no-init-file no-splash any combination, Fctix stops working.
  3. After some research, what I figured out is that the ‘ -Q’ argument automatically sets inhibit-x-resources to t, in addition to prevent the initialization of site and init files. link1 link2
  4. To my surprise, after disable ~./Xresoures, and restart Arch Linux, Fcitx works fine with Emacs. Please note that the Emacs built-in IME still could be evoked with C-\. Scr-fcitx-emacs.png

    I have following code in ./Xresources

    In script file .xprofile, add following lines to support GTK+ and Qt modules Fcitx in Arch Linux.

  5. Following are related setting about locale in Arch Linux.

  6. Hope this will be of help to someone.

Never ending…

fcitx stops working after recent update 09/14/2019. It is refuse to work even when I update to Emacs 26.


  1. use fcitx-diagnose to check fcitx setting manually removed /usr/lib/gtk-2.0/lib32, fixed error in fcitx-diagnose.
  2. fcitx-diagnosis

  3. xlsfonts |grep r-normal–14 check fonts
  4. start Emacs with presetting

  5. played with ./xprofile and .pam_environment
  6. daemon and client mode with Emacs 26 added Environment variables. Arch and Arch
  7. regenerate the locale
  8. fontconfig see Arch Fonts
  10. font-path in xorg Emacs 24.3 with FCITX input methods{Resolved in 14.2} – Page 2 – Salix OS Emacs GUI下不能输入中文 – Emacs-general – Emacs China

    新建 /etc/X11/xorg.conf.d/fonts.conf 写入


  11. How to install Chinese fonts and input method in Arch Linux


  1. Xiang  December 22, 2015

    I see that this is something that works on ArchLinux. Do you also have any idea how an analogy might be on Ubuntu? I set LC_CTYPE=zh_CN.UTF-8 on Ubuntu, and I can now switch fcitx input engines. However, I still can’t input any Chinese or Japanese characters. All the input automatically becomes normal English character one by one. Also If I tried to key in the acute mark in Spanish input, an error message is shown: ” is undefined”, so it’s still not working. Only languages like German, which directly input characters, seem to work.

    • mistan  December 30, 2015

      Hi Xiang,

      I will try it out with my Ubuntu box when I have a chance.



Add a Comment