The role of useunicode=true&characterencoding=utf-8 in MySQL connection URL

Source: Internet
Author: User

The purpose of the addition is to specify the encoding and decoding format of the characters.             

For example: The MySQL database uses GBK encoding, and the project database uses UTF-8 encoding. If Useunicode=true&characterencoding=utf-8 is added at this time, then there are two aspects of the function:

1. When data is stored:

When storing the project data, the database decodes the data into bytecode using the UTF-8 format, and then the decoded bytecode is reused in the database using the GBK encoding.

2. When data is taken:

When fetching data from the database, the database will first decode the data in the database into bytecode in GBK format, then encode the decoded bytecode again in UTF-8 format, and then return the data to the client.

NOTE: When you configure Database utl in an XML configuration file, to use the & escape character is also & For example:

<name= "url"  value= "Jdbc:mysql://localhost:3306/email?" Useunicode=true&amp;characterencoding=utf-8 "/>

Special characters commonly used in HTML:

Most commonly used character entities (Character entities)
Show results Description Entity Name Entity number
Show a space &nbsp; & #160;
< Less than &lt; & #60;
> Greater than &gt; & #62;
& & Symbols &amp; & #38;
" Double quotes &quot; & #34;

Other commonly used character entities (Character entities)
Show results Description Entity Name Entity number
© Copyright &copy; & #169;
® Registered trademarks &reg; & #174;
X Multiplication sign &times; & #215;
÷ Division Sign &divide; & #247;

The role of useunicode=true&characterencoding=utf-8 in MySQL connection URL

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.