UseUnicode = true & amp; characterEncoding = UTF-_ mysql in the MySQL connection url

Source: Internet
Author: User
Role of the useUnicodetrueamp; amp; characterEncodingUTF-8 in the mysql connection url bitsCN.com

Functions of useUnicode = true & characterEncoding = UTF-8 in mysql connection url

When we connect to the mysql database, we usually add useUnicode = true & characterEncoding = UTF-8 after the url, but what do you want to add?

The added function is to specify the encoding and decoding formats of characters.

For example, the mysql database uses gbk encoding, while the project database uses UTF-8 encoding. At this time, if useUnicode = true & characterEncoding = UTF-8 is added, the role has the following two aspects:

1. when saving data:

When the database stores project data, it first decodes the data into bytecode in UTF-8 format, and then stores the decoded bytecode into the database again using GBK encoding.

2. Data Retrieval:

When retrieving data from the database, the database first decodes the data in the database in GBK format into bytecode, and then decodes the decoded bytecode and re-encodes the data in UTF-8 format, finally, return the data to the client.

Note: When configuring the database URL in the xml configuration file, use the & Escape character, that is &

For example:

Common special characters in HTML:

Character Entities)

Display result description Entity Name Entity Number

Display a space

<Less than <

>>>>

& Symbol &&

"Double quotation marks ""

Character Entities)

Display result description Entity Name Entity Number

? Copyright©©

? Registered trademark®®

× Multiplication number ×

& Pide; Division number & pide; Division

BitsCN.com

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.