Rails Chinese Issues Summary

Source: Internet
Author: User
Rails Chinese question 1. Set UTF-8 to encoded format when MySQL is installed. It is said that modifying the configuration file does not work, it is only useful if you set up the encoding format when you install the database. 2. Set the encoding format in the database.yml of your rails project Development:adapter:mysql database:cn_development Encoding:utf8Username:root Password:eman host:localhost 3. Set all rhtml file encoding formats for UTF-8 < head > <meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>< title > Book: <%= controller.action_name%> </title > <%= stylesheet_link_tag ' scaffold '%>   /head > At this point, the Rails program's interface should be able to display Chinese correctly, whether it is the text on the page, or the Chinese reading and writing from the database, can be displayed correctly. 4. But there are some small problems, through the rails program on the database read and write when the console on the display of garbled, while using CMD access to the database, also show a tangle. This is mainly because Windows Cmd/console only supports GBK, and the data is stored in UTF8 in the database, so it's a mess to read out and display with GBK. To resolve database cmd access you can set the encoding when connecting to the database to notify MySQL that it requires the data to be accepted with GBK encoding: Mysql-uroot-peman --DEFAULT-CHARACTER-SET=GBK 5. How to troubleshoot console shows the problem that needs further study.

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.