Chinese Character Display on Colibri i.MX6 with Linux

I connect to Colibri i.MX6 with Linux via SSH and create a fold with Chinese character. But when listing current path with ‘ls’ command, the Chinese character doesn’t display correctly. The console I use should be ok as Chinese character can be input and showed correctly.

root@colibri-imx6:~# mkdir 中文目录测试
root@colibri-imx6:~# ls
Desktop  hello	list_file  mnt	test  ??????????????????

But with PCManFM from default BSP, this fold with Chinese character display correctly. So other application like Qt just can’t open or create Chinese fold. Some environment varieties are added as well.

Could you please provide advice about it ? Thanks!

I checked the defconfig of busybox on OpenEmbedded at stuff/openembedded-core/meta/recipes-core/busybox/busybox/defconfig


CONFIG_LAST_SUPPORTED_WCHAR=0, it means ‘0 - off, any valid printable Unicode character will be printed.’ So busybox has nothing to do with Chinese character. Am I right ?

I write a simple program to test. This program is launched vis SSH as well. And now it can create Chinese name folder and read it. But with command ‘ls’ in SSH session, the Chinese character still doesn’t display well.

#include <dirent.h> 
#include <stdio.h> 
#include <sys/stat.h>
#include <sys/types.h>

int main(void)
  DIR           *d;
  struct dirent *dir;
  int result = 0;
  result = mkdir("测试", 0777);
  	printf("Failed to create folder.\n");
  d = opendir(".");
  if (d)
    while ((dir = readdir(d)) != NULL)
      printf("%s\n", dir->d_name);


Adding following varieties to /etc/profile make them available globally. Now Chinese character display well on SSH session.

export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8
export LANG=zh_CN.UTF-8

This probably would need a fix along those lines.

On a systemd system there is also localectl to control locale settings. But I guess it wouldn’t make a difference., Just looked into that a bit closer, for another customer request, and thought I document my findings here for the time being.

Note that our images ship by default no tools to generate locales and also don’t ship additional locales such as zh_CN. However, when OpenEmbedded builds locales for the target, they always support UTF-8! ( Ångström sets LOCALE_UTF8_ONLY to 1). This means that even the default en_US locale is UTF-8 capable.

So on a SSH session, using

export LC_ALL=en_US
export LANGUAGE=en_US
export LANG=en_US

Should already allow Chinese characters (or adding that to /etc/profile).

For the serial console, the system locale counts, which can be configured using

localectl set-locale LANG=en_US

However, BusyBox, which provides essential utilities such as ls, currently does not support Unicode. For now, you can install Coreutils using:

opkg update
opkg install coreutils

Thanks Stefan. Yes, you are right. Our default image doesn’t support Chinese character. I just add ‘zh-cn’ to ‘IMAGE_LINGUAS’ in oe-core/v2.6/stuff/meta-toradex/recipes/images/ and recompile it.

IMAGE_LINGUAS = "en-us zh-cn"