linux coding problems caused because the system under the garbled solutions (transfer)

2011-05-03  来源:本站原创  分类:OS  人气:161 

because the system under linux coding solutions to problems caused garbled

Run dry recently encountered some applications in linux system report the following problems garbled, after the final inspection are found to be the default client encoding settings linux systems caused by the incorrect, which causes the phenomenon of garbled procedures which are generally write Chinese characters can die normal show, but taken out from the database or from the program read out the Chinese characters will appear garbled, here are what set the linux system code caused by incorrect reporting applications run dry garbage problem solution.

Step one: Check the linux system encoding.

Check the linux system code, to determine whether the system supports Chinese. Linux system in the terminal enter the command: locale, you will see the information printed in the system encoding. If you print out the information below, then the coding system does not support Chinese:

LANG = en_US.UTF-8

LC_CTYPE = "en_US.UTF-8"


LC_TIME = "en_US.UTF-8"




LC_PAPER = "en_US.UTF-8"

LC_NAME = "en_US.UTF-8"





The system supports Chinese print out the information should be encoded as shown below:

Step Two: Modify the system default encoding settings

If you find that the system does not support Chinese encoding, then we should modify the system code, to support the Chinese, the Chinese report that run dry in the application will not garbled.

Modify the system code as follows:

/ Etc/sysconfig/i18n

Controls the system font settings. The language variables are used in / etc / profile.d / An example i18n file:

LANG = "en_US.GB18030"

LANGUAGE = "en_US.GB18030: en_US.GB2312: en_US"

SUPPORTED = "en_US.GB18030: en_US: en: en_US.UTF-8: en_US: en"

SYSFONT = "lat0-sun16"

These are the system's default character set is in English if we want to support the Chinese character set, and can be changed by setting the file system's default character set.

Alternatively, the user's environment variables in the user's environment variables file or add the path variable declaration:

In the pre-file a statement of the system, so that the whole system works:

# Vi / etc / profile

At the end of the file add

LC_ALL = "zh_CN.GBK"

export LANG = "zh_CN.GBK"

Pre-file in the user's statement on the individual user works:

# Vi / root / .bash_profile

At the end of the file add

export LC_ALL = "zh_CN.GBK"

export LANG = "zh_CN.GBK"

The above configuration restart the server for the changes to take effect.

Step Three: View the modified system default encoding.

The operation of the above steps and then restart the computer, and then enter the command in the terminal: locale, then you will see the character set information into the system the following elements:

This system code to support Chinese, and after these changes, because the system default encoding does not support the Chinese cause of garbled to be successfully resolved.

Tag after linux, Chinese encoding, garbled, the system default encoding

  • linux coding problems caused because the system under the garbled solutions (transfer) 2011-05-03

    because the system under linux coding solutions to problems caused garbled Run dry recently encountered some applications in linux system report the following problems garbled, after the final inspection are found to be the default client encoding se

  • Linux, the problems caused by multiple jdk 2010-06-07

    Javac Times in linux in the implementation of the following error: This script is a placeholder for the / usr / bin / javac master link required by conventions. libgcj's rmiregistry, rmic and jar tools are now

  • coding problem under linux because the system caused by garbled solution (transfer) 2011-05-03

    coding under linux because the system solution to problems caused by garbled The most recent encounter some applications run dry in a linux system reports the following garbled, and last inspection were found to be the customer's default encoding set

  • java coding problems in Chinese sentiment 2008-12-18

    String newStr = new String (oldStr.getBytes (), "UTF-8"); java's String class is conducted in accordance with unicode encoding, when using the String (byte [] bytes, String encoding) constructor string, encoding refers to the bytes of the data i

  • Use solr in the php linux client problems 2010-08-09

    Use solr in the php linux client problems 1: When I use solr php when the client is always limited! The reason is in play tricks ~ selinux Need to modify the boolean value selinux apache Allow HTTPD scripts and modules to connect to cobbler voer the

  • Linux and Windows dual-system problems caused by system time 2011-01-10

    Spent some time out of ubuntu, that enter the xp boot after ubuntu, the time is wrong, the solution Windows and Mac / Linux the default time to look at the way the system hardware is not the same: Windows to local time as the hardware time (local tim

  • xp linux dual system bootmgr is missing solutions 2010-09-06

    Forced by economic pressures can only be installed dual system Originally installed is xp, just installed Fedora 13, the installation was successful, I want to enter xp, there bootmgr is missing .... The reason is to install Fedora, use grub to manag

  • Linux 2.4.30 kernel file system learning (multi-map) 2010-12-22

    I. Overview Based on previous experience of learning the kernel source, the file system implementation in the study, I probably had a learning objectives set: 1, the establishment of a clear overall concept. Details of the code needed for the future

  • Linux 2.4.30 kernel file system learning: a virtual file system (multi-map) 2010-12-22

    This is an old article I published in CSDN, now re-released to the JAVAEYE, and re-finishing. I. Overview Linux file system is very complex, this article only the implementation of virtual file system on specific file system does not involve. Even th

  • apache log problems caused io 2011-03-14

    The company used to apache + jetty / jboss architecture model, apache logging assumed a duty. Colleagues do a performance test, found a strange phenomenon: 15 concurrent direct pressure apache, load actually reaching more than 100, tps only 200. Back

  • Linux permissions problems under the ADT 2010-03-29

    Use linux under the ADT school Android, to run when you could not create temp file for system NAND disk image: Permission denied After a search solution: Root cuase: avd related files are stored in / tmp / android, but you may do not have permission

  • Frequent distribution of free memory performance problems caused by the analysis of (Reprinted) 2010-03-29

    Phenomenon A pressure testing, found that the performance measured object is not ideal, the specific performance: CPU consumption of the system state process 20, the user mode CPU consumption of 10, the system idle about 70 2 Use the ps-o majflt, min

  • Find an array of problems caused by 2010-04-23

    Internal class BlockDataInputStream.'s Method peekByte thrown, meaning that to reach the end of the file, the program did not properly read the file contents end Client: streamToServer.println (userName +";"+ strPwd); / / send to the Server name

  • The float data type mysql problems caused by 2010-05-14

    Note: This version is referred to mysql mysql-essential-5.1.44-win32 Last month I had had the disposal of mysql because mysql transaction processing (see a blog before), but before the development of a system is mysql, and suddenly have a client woul

  • linux application in view of the system occupied by the port 2010-06-17

    View the application in the linux system occupied the port can use netstat command. netstat-ap Can view the system occupied all ports (including ports in a listening state), and the occupation of the port of the process pid. If you want to view desig

  • When under linux build problems and solutions 2010-06-30

    The first time in linux compile open source project, note the problems and solutions. 1. Could not find wxWidgets library. Solution: $ sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common 2. Need libsmbclient.h for compiling on

  • [Linux] lsof command and delete files under (Linux. Handle problems with the release of space) 2010-07-01

    Introduction: First, the facts speak Second, on the other LSOF command usage: 3, reference documentation: Body: lsof: Finding open files with lsof Role: See what process the file is opened First, the facts speak Experimental] [Linux delete the file,

  • JAVA development process, programming code on how to avoid performance problems caused by? 2010-07-22

    In the program development process how to write code to avoid performance problems, J2EE development projects are mostly large-scale projects, BS framework therefore more stringent requirements in terms of performance! Parameter adjustment through mi

  • linux inotify monitoring changes in the system directory under the 2010-08-26

    Recently we were project needs in a timely manner to delete the cache files generated Nginx services, Youyubushi Henle Jie Nginx Huancun generated Policy, Zhao, on-line Meiyou carefully deliberated, the final hope into liunx the inotify Gongneng, Jia

  • By the Autoboxing \ unboxing (automatically installed packages \ unpacking) the problems caused by 2010-12-16

    By the Autoboxing \ unboxing (automatically installed packages \ unpacked) caused problems: In the Tools HttpUtil there is a method, its return type is int, is the need to change the return type of Integer type, Because after the introduction of the