linux busybox中文顯示修改教程,linuxbusybox

來源:互聯網
上載者:User

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

這樣在終端就能正常顯示中文。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.