Traditional Culture Encyclopedia - Tourist attractions - How to output UTF-8 encoded string using GB18030 in Java?
How to output UTF-8 encoded string using GB18030 in Java?
Java is very convenient for this kind of conversion
If the input is UTF8 bytes, use
String s=new String(utf8_bytes, "UTF-8") ; //utf8_bytes is of byte[] type
If the input is a string, return directly
String s=original.
When the output is converted to gb18030, there is no need to convert when not outputting.
os.write(s.getBytes("GB18030")); //os is the output stream
- Previous article:Write a 350-word composition at a tourist attraction.
- Next article:Guangzhou travel guide
- Related articles
- Difference between Family Sponsored Visitor Visa and Tourist Visa
- Qingzhou tourist attractions introduction Qingzhou one-day tour guide and scenic spots introduction
- I am in Huzhou, Zhejiang and want to visit West Lake in Hangzhou. Is there enough time to go and return on the same day?
- In this beautiful spring day, how to take good-looking photos for tourists when traveling abroad?
- Can I climb Mount Laoshan by myself if I am 15 years old?
- Tun-Fuchunjiang Travel Guide-Fuchunjiang Three-Day Tour Guide
- I don't understand why a package tour to Europe will also be refused. Isn't it that the rejection rate of newspaper groups is not high?
- Dreaming about going to a hot spring with your boyfriend is an omen.
- The 2021 Kaifeng Tourism Annual Pass is temporarily suspended
- Are there any tourist attractions you can recommend?