Emma Chinese display garbled Problem Solving

Source: Internet
Author: User

Emma Chinese display garbled problem solved in Linux if you use the mysql graphics client, I personally feel that Emma is not bad. However, if emma is installed with apt-get by default, emma does not support Chinese characters. You need to modify the configuration file by yourself, or directly modify the emma program source file (emma is written in python ). Apt-get install emmaJava code sudo apt-get install emma if you have installed emma and run emma, the program will be created ~ /. Emma/emmarc file to save some of your configurations. Therefore, you can change the configuration file or directly modify the python source file of emma as follows. Java code vim ~ /. Emma/emmarc: Change db_encoding = latin1 to db_encoding = utf8 and run emma again. The code is garbled. Do not worry. Add this SQL statement before executing all the SQL statements: after the Java code set names utf8 is executed by pressing ctrl + enter, check whether it is OK. Chinese characters are displayed normally. (The premise here is that your database is UTF-8 encoded.) but it is not very laborious to add this statement before each new user changes the configuration file and executes the new SQL statement. I am very lazy, and most of my databases are utf8, So I directly modify the emma source file to implement it. The newly created emmrc configuration file is utf8, and when the database is selected, the "set names utf8" statement is automatically executed. Install emma in apt-get of ubuntu under the/usr/share/emma directory. Java code cd/usr/share/emma/emmalib sudo vim _ init _. py find "db_encoding": "latin1" changed to "db_encoding": "utf8" Save and quit. In the future, the new configuration file will be UTF-8 decoded by default. I want to execute the "set names utf8" statement after the data is connected, therefore, the Java code sudo vim/usr/share/emma/emmalib/mysql_host.py jumps to the _ use_db (self, name, do_query = True) Function Around 155 rows, (compare to add ...) Java code def _ use_db (self, name, do_query = True): if self. current_db and name = self. current_db.name: return if do_query: self. query ("use '% S'" % name, False) self. query ("set names utf8", False) try: self. current_db = self. databases [name] looks at it and changes it to the above format. Pay attention to spaces, because python uses the space-based statement segmentation syntax. This is the complete OK.

Related Article

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.