In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
What is a character set?
Before we introduce the character set, let's take a look at why there is a character set. What we see on the computer screen is materialized text, while what is stored in the computer storage medium is actually a binary bit stream. Then the conversion rules between the two need a unified standard, otherwise our USB drive will be plugged into the boss's computer, the document will be garbled; the file uploaded by my friend QQ will be opened locally and garbled again. Therefore, in order to realize the conversion standard, various character set standards appear. To put it simply, the character set defines the conversion relationship between the storage of binary numbers corresponding to a text (encoding) and which text (decoding) a string of binary values represent.
So why are there so many character set standards? This question is actually very easy to answer. Ask yourself why our plugs can't be used in the UK. Why does the monitor have so many DVI,VGA,HDMI,DP interfaces at the same time? Many norms and standards are not aware that they will be universal norms in the future, or that they want to be essentially different from existing standards in the interests of the organization itself. As a result, there are so many standards that have the same effect but are not compatible with each other.
Having said so much, let's take a look at a practical example. here are the hexadecimal and binary coding results of the word Jiao under various codings. is there a cool feeling?
Character set hexadecimal encoding corresponding binary data UTF-80xE5B18C1110 0101 1011 0001 1000 1100UTF-160x5C4C1011 1000 1001 1000GBK0x8CC51000 1100 1100 0101
Introduction
We always encounter some Chinese coding problems in the process of programming, which need to be filtered and escaped in many aspects of the program, and it is still possible to encounter the problem of Chinese garbled codes. The following is a method that one of my colleagues told me that does not work all the time, of course, it is for the tomcat server.
In addition, this approach does not conflict with previous methods.
Server / conf directory / server.xml file
Change the relevant statement to:
There is no URIEncoding= "UTF-8" in the previous statement.
A friend asked a question: this method seems to be valid only for get requests, how to solve POST requests? In addition to req.setCharacterEncoding ("UTF-8"); this method?
In fact, the problem of garbled code requires the overall planning of the whole system. From your database design, background character filtering, foreground data transfer. Using req.set alone doesn't always work.
So, if you submit by post, first check whether the database format is utf8, and second, whether the form form submitted by post has been set up utf8.
Summary
The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.