current position：Home>Java byte array and string conversion
Java byte array and string conversion
2022-02-03 00:38:19 【CSDN Q & A】
according to String Construction method of String(byte a, int startIndex, int count),
Should not be length=2 Return Chinese characters when “ Meet " Do you , But it's equal to 2 When you print it out, it's not , Only length=3 When it comes to " Meet ”
Don't Chinese characters occupy two byte codes ？
Refer to the answer 1：
GBK code , A Chinese character takes up two bytes .
UTF-16 code , Usually Chinese characters occupy two bytes ,CJKV Expand B District 、 Expand C District 、 Expand D The Chinese characters in the area occupy four bytes （ General character Unicode The scope is U+0000 to U+FFFF, The scope of these extensions is larger than U+20000, So it takes two UTF-16）.
UTF-8 Coding is variable length coding , Usually Chinese characters occupy three bytes , Expand B The Chinese characters after the area occupy four bytes .
Refer to the answer 2：
author[CSDN Q & A],Please bring the original link to reprint, thank you.
The sidebar is recommended
- How to use stu method to input student names and grades in pyton and store them in the list
- If you enter the title of a book, the length of each title is no more than 100, and the books are sorted in ASCII order from small to large. Enter the number of book titles indefinitely until the end of the document. Sort the string from small to large ac
- Python selenium loading is slower than opening the web card normally. Is there any solution
- When the database connection is normal, it is impossible to add, delete, modify and query the data in the database
- How to realize NS3 traffic load distribution
- How to enter the grades of each subject? Do you need a two-dimensional array for each subject
- Please answer what this is
- How to define and initialize structures in. H
- In C language, the input content is larger than the defined array, but can it be output?
- The running result is not expected (c + +)
guess what you like
matlab . Image pixel processing
The process of solving these more than 2000 functions through subs is too slow
Longest common prefix, binary search problem
Basic HTML5 code table and usage
Error is reported after Vue project is started. Please ask for help
How can I open the database in the examinee's folder for computer level 2 MySQL test questions?
The following program (function) deletes the characters exactly the same as the string S2 in the string S1, such as S1: China S2: in, and the result is cha
Why NP The empty ((3,2)) element is not random?
Why do you report an error? Find a solution
Using C + + and pcap H and iphlpapi H. how to solve the problem?
- How can I fix the problem of uploading to idea
- com. fasterxml. jackson. databind. Objectmapper throw exception
- What is the reason and how to solve it
- Preparestatement of javajdbc
- int x=8,y=12,z=14 ; x++,y=z++,z=++x; y=x%z- -; Find the value of XYZ
- Why is this the case when I access the PHP test program under localhost in MacOS?
- Why should this code be int & n instead of int n? In C + +, under what circumstances do you need to be int & n
- The redis session problem runs well locally. As soon as it arrives online, it crazy reports exceptions. It starts to report when it starts. And the function can be used normally
- Research on Professional Course Scheduling Based on nonlinear programming
- The question about C + +: that's it: include 'Einstein h'
- Sqlyog failed to import the database. I don't know what to do
- The Microsoft edge browser can only enter the address in the address bar and cannot search
- Why can't data be saved when text is written in this way?
- When the user logs in and out, a socket error is reported when he logs in again
- The website editor cannot be right-click pasted and cannot be used
- On the problem of multi-threaded ball taking and putting (language Java)
- Start the flume script and report an error in the generated log file: agent configuration for 'A1' has no configfilters
- What can reflect the professional quality of a yard farmer?
- Why is the returned hour, minute and second Nan
- Python, C problem - leap year judgment
- SQL. Why not attach it, as shown in the figure
- How does robotjs set automatic rebuild in electronic build
- Python final exam SOS
- I admit that I have degenerated, but I still want to know how to solve Java
- I have encountered several array problems in C + +. I hope the big God can solve the puzzle. It's best to have comments
- Why is it double? don't get it
- C language novice village, high adoption rate
- The usage and law of this function are expected to be explained.
- Let's see what's wrong. My code will output one less country
- Why is the average 0
- The replacement of tab key in hive leads to a problem in the file.
- Now to realize a function, use the El tree component of element UI, select the relevant node, and then copy a new tree with only relevant parent-child nodes below.
- Sqlyog database import failed with the following error. Do you know
- How do two lists compare in the same location
- How to group the following data by film and television, education, music, E-sports and other sectors
- Server socket + Android socket can only send a message once after connecting. The second sending does not respond. You need to reconnect the socket and solve it
- Questions about student information management system C++
- Qtable widget of QT double click to edit and display the problem
- Separate strings and insert a comma for each 5 characters
- QT qtablewidget double click to modify the content. What is the problem