Linux busybox Chinese display modification tutorial, linuxbusybox

Source: Internet
Author: User

Linux busybox Chinese display modification tutorial, linuxbusybox
1. kernel Modification

Go to the kernel and run make menuconfig.

Go

File systems --->

Native language support --->

UTF-8 NLS

Choose NLS UTF-8 to save and exit the compiling kernel.

2. Modify busybox

Modify the two parts in printable_string.c as follows:

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++;}

The red part is the modified part.

Modifying unicode. c function 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;}

The red part is the modified part. After modification, recompile busybox.

Add parameters when mounting a File System

Iocharset = utf8

In this way, Chinese characters can be displayed normally on the terminal.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.