linux busybox中文顯示修改教程,linuxbusybox
1.核心修改
進入核心,執行make menuconfig後
依次進入
File systems --->
Native language support --->
NLS UTF-8
選上NLS UTF-8 儲存退出編譯核心.
2.busybox修改
修改檔案printable_string.c中兩處,如下:
while (1) {unsigned char c = *s;if (c == '\0') {/* 99+% of inputs do not need conversion */if (stats) {stats->byte_count = (s - str);stats->unicode_count = (s - str);stats->unicode_width = (s - str);}return str;}if (c < ' ')break;#if 0 //modifyif (c >= 0x7f)break;#endifs++;}
while (1) {unsigned char c = *d;if (c == '\0')break;#if 0 //modifyif (c < ' ' || c >= 0x7f)#elseif (c < ' ')#endif*d = '?';d++;}
紅色部分為修改部分.
修改 unicode.c函數unicode_conv_to_printable2中
if (unicode_status != UNICODE_ON) {char *d;if (flags & UNI_FLAG_PAD) {d = dst = xmalloc(width + 1);while ((int)--width >= 0) {unsigned char c = *src;if (c == '\0') {do*d++ = ' ';while ((int)--width >= 0);break;}#if 0 //modify *d++ = (c >= ' ' && c < 0x7f) ? c : '?';#else*d++ = (c >= ' ') ? c : '?';#endifsrc++;}*d = '\0';} else {d = dst = xstrndup(src, width);while (*d) {unsigned char c = *d;#if 0 //modify if (c < ' ' || c >= 0x7f)#elseif (c < ' ')#endif*d = '?';d++;}}if (stats)stats->byte_count = stats->unicode_count = (d - dst);return dst;}
紅色部分為修改部分,修改後重新編譯busybox.
檔案系統執行掛載時加入參數
iocharset=utf8
這樣在終端就能正常顯示中文。