If you use an SSH terminal app on Android to manage a Linux server, you may find that typing Chinese or Japanese characters produces gibberish or nothing at all. This guide explains how to configure both the terminal app and the server so that CJK input works reliably, including IME integration and locale settings.
What You’ll Need
- An Android SSH terminal app that supports custom input methods (e.g., Termux, JuiceSSH, ConnectBot).
- A server running Linux or BSD with SSH access.
- Basic familiarity with editing files on the server (using nano or vi).
- Optional: A physical or on-screen keyboard that can input CJK characters.
Step-by-Step
- Check your terminal app’s encoding settings. Most SSH apps default to UTF-8, which is essential. Open the app’s settings and ensure the character encoding is set to UTF-8. If it’s set to something else (like ISO-8859-1), change it and reconnect.
- Verify the server’s locale. On the server, run
localeto see the current locale. If it showsCorPOSIX, you need to generate a UTF-8 locale. For example, on Debian/Ubuntu, runsudo locale-gen en_US.UTF-8(or your preferred language) and thensudo update-locale. - Set the server’s default locale. Edit
/etc/default/locale(Debian/Ubuntu) or/etc/locale.conf(Arch) and setLANG=en_US.UTF-8(orja_JP.UTF-8for Japanese). Reboot or log out and back in to apply. - Configure the shell to accept UTF-8 input. In your shell’s startup file (e.g.,
.bashrc), add:export LANG=en_US.UTF-8andexport LC_ALL=en_US.UTF-8. Then runsource ~/.bashrc. - Enable CJK input in the terminal app. Some apps have a dedicated setting for IME (Input Method Editor). For example, in Termux, go to Settings → Keyboard and enable “Use IME” or “Fullscreen IME”. In JuiceSSH, look for “Input Method” in the connection settings.
- Switch your Android keyboard to Chinese or Japanese. Install a keyboard like Gboard or Google Japanese Input, then add the language in the keyboard settings. Switch to it while typing in the SSH session.
- Test with a simple command. Type
echo こんにちは(Japanese) orecho 你好(Chinese) and press Enter. If the output shows the characters correctly, it’s working. If not, proceed to troubleshooting.
Common Mistakes
- Forgetting to set the server locale – Even if the terminal sends UTF-8, the server may not display it correctly without a UTF-8 locale.
- Using a terminal app that doesn’t support IME – Some apps ignore the Android IME and only accept hardware keyboard input. Check the app’s documentation.
- Not restarting the SSH session – Locale changes on the server only take effect after you log out and reconnect.
- Mixing up encoding in the app – Some apps have separate settings for display and input encoding. Make sure both are UTF-8.
Tips
- Use a terminal app that has active development, as CJK support improves over time.
- If you’re using a hardware keyboard, ensure it’s set to the correct layout (e.g., Japanese JIS).
- Consider using a screen reader or accessibility tool to verify the characters are being sent correctly.
- For frequent use, create a shell alias or script that sets the locale automatically when you connect.
Troubleshooting
If you still see garbled text or no input, try these steps in order:
- Check the app’s log or debug output. Some apps show connection logs that reveal encoding issues.
- Try a different terminal app. If one app fails, another may work. For example, Termux is known for good IME support.
- Test with a local echo. In the SSH session, type
stty -aand check theiutf8flag. If it’s not set, runstty iutf8. - Check the server’s SSH configuration. Ensure
AcceptEnv LANG LC_*is not set in/etc/ssh/sshd_configunless you’re sending locale variables from the client. If it is, the server may override your locale. - Use a different keyboard. Some keyboards send characters in a non-standard way. Try Gboard or another popular keyboard.
- Verify the server’s filesystem encoding. If you’re typing filenames, ensure the filesystem supports UTF-8 (most modern ones do).
Frequently Asked Questions
Why does my Chinese input show as question marks?
Question marks usually mean the server’s locale is not UTF-8. Run locale on the server and set it to a UTF-8 locale as described above.
Can I type Japanese kanji in SSH?
Yes, as long as your keyboard and terminal both support UTF-8 and the server locale is set correctly. The process is identical to Chinese.
Do I need root access on the server to fix this?
You need root to change the system locale, but you can set the locale in your shell profile without root. However, the system locale change is more reliable.
Why does my terminal app not show the IME option?
Some apps hide the IME setting unless you have a hardware keyboard connected. Try connecting a Bluetooth keyboard or check the app’s advanced settings.
Will this work with any SSH server?
Yes, as long as the server runs a modern Linux/BSD with UTF-8 support. Older systems may need additional configuration.
Can I use this method for other languages like Korean?
Yes, the same steps work for any language that uses UTF-8 encoding, including Korean and other CJK languages.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Selenium Tests on IE & Edge: Step-by-Step
- Block Pop-Ups in Windows Browsers: Safe Fixes
- Fix AMD Catalyst Control Center Missing on Windows
- Fix WhatsApp Desktop Keeps Logging Out
- Google Pixel vs OnePlus: Key Differences
- Unleash Your Inner App Developer: Getting Ready