Linux设备vi编译中文显示..分析与解决

问题

        linux设备,cat文件可显示中文字符,vi显示..,文件名显示?。

分析

        busybox版本:busybox-1.29.3,vi和cat都是链接的busybox,怀疑是没有支持UTF8编译导致问题,网上搜索说需要修改busybox源码,主要是把大于0x7F的字符注释掉,修改后没有生效,中文在编辑状态还是显示..,但确实解决了文件名不能显示中文的问题。

        对比其他IMX6设备,编译状态能正常显示中文,对比busybox的配置差异和内核配置差异,发现有些配置没有打开,对比差异打开配置后,中文在编译状态能正常显示。

解决

        busybox配置添加:打开CONFIG_FEATURE_CHECK_UNICODE_IN_ENV和CONFIG_FEATURE_VI_8BIT

 #
 CONFIG_HAVE_DOT_CONFIG=y
 
@@ -107,7 +107,7 @@ CONFIG_FEATURE_EDITING_WINCH=y
 # CONFIG_LOCALE_SUPPORT is not set
 CONFIG_UNICODE_SUPPORT=y
 # CONFIG_UNICODE_USING_LOCALE is not set
-# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
+CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
 CONFIG_SUBST_WCHAR=63
 CONFIG_LAST_SUPPORTED_WCHAR=767
 # CONFIG_UNICODE_COMBINING_WCHARS is not set
@@ -330,10 +330,10 @@ CONFIG_BASE64=y
 CONFIG_UUENCODE=y
 CONFIG_WC=y
 CONFIG_FEATURE_WC_LARGE=y
 CONFIG_WHOAMI=y
 CONFIG_WHO=y
 CONFIG_W=y
 CONFIG_USERS=y
 CONFIG_YES=y

 #
@@ -416,7 +416,7 @@ CONFIG_PATCH=y
 CONFIG_SED=y
 CONFIG_VI=y
 CONFIG_FEATURE_VI_MAX_LEN=4096
-# CONFIG_FEATURE_VI_8BIT is not set
+CONFIG_FEATURE_VI_8BIT=y
 CONFIG_FEATURE_VI_COLON=y
 CONFIG_FEATURE_VI_YANKMARK=y
 CONFIG_FEATURE_VI_SEARCH=y
@@ -507,10 +507,10 @@ CONFIG_USE_BB_PWD_GRP=y
 CONFIG_USE_BB_SHADOW=y
 CONFIG_USE_BB_CRYPT=y
 CONFIG_USE_BB_CRYPT_SHA=y

        内核kernel配置添加:打开CONFIG_NLS_ASCII=y和CONFIG_NLS_UTF8=y,修改CONFIG_NLS_DEFAULT="cp437"

@@ -3096,7 +3096,7 @@ CONFIG_SUNRPC=y
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
 CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_DEFAULT="cp437"
 CONFIG_NLS_CODEPAGE_437=y
 # CONFIG_NLS_CODEPAGE_737 is not set
 # CONFIG_NLS_CODEPAGE_775 is not set
@@ -3120,7 +3120,7 @@ CONFIG_NLS_CODEPAGE_437=y
 # CONFIG_NLS_ISO8859_8 is not set
 # CONFIG_NLS_CODEPAGE_1250 is not set
 # CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
@@ -3145,7 +3145,7 @@ CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_MAC_INUIT is not set
 # CONFIG_NLS_MAC_ROMANIAN is not set
 # CONFIG_NLS_MAC_TURKISH is not set
-# CONFIG_NLS_UTF8 is not set
+CONFIG_NLS_UTF8=y
 # CONFIG_DLM is not set

你可能感兴趣的:(Linux,linux)