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 utl in the XML configuration file, use the & escape character, that is, & amp;
For example: <property name = "url" value = "JDBC: mysql: // localhost: 3306/email? Useunicode = true & amp; characterencoding = UTF-8"
/>
Common special characters in HTML:
Character entities)
Display result |
Description |
Entity name |
Entity number |
|
Display a space |
& Nbsp; |
& #160; |
< |
Less |
& Lt; |
& #60; |
> |
Greater |
& Gt; |
& #62; |
& |
& Symbol |
& Amp; |
& #38; |
" |
Double quotation marks |
& Quot; |
& Amp; #34; |
Character entities)
Display result |
Description |
Entity name |
Entity number |
|
Copyright |
& Copy; |
& #169; |
|
Registered Trademark |
& Reg; |
& #174; |
× |
Multiplication number |
& Times; |
& #215; |
Bytes |
Division Number |
& Divide; |
& #247; |