Home > Back-end >  How to identify the double-byte characters, such as Chinese characters
How to identify the double-byte characters, such as Chinese characters

Time:10-01

Want to consult:
Such as "|", in view of the character set GBK, I how to recognize the Chinese characters and |
Good | a total of three bytes
The characters of high bit must be the first, this no doubt, but the low byte highest can also be 1, or 0
Why this is the first and the second byte double-byte characters "good", while the third byte is single-byte?
Why isn't the first byte is single-byte characters, while the second (assuming the highest is 1) and the third byte constitutes a double-byte characters?
thank you

CodePudding user response:

Like bears before post, and questions? If not dried shrimp in particular, general judgment, like this can mix output,

CodePudding user response:

reference 1/f, the wise know already should good karma response:

To be honest, I didn't see
thank you

CodePudding user response:

This what you use coding, uncertain coding can't determine the rules

CodePudding user response:

Yes, look at the output of rendering, because I do not know application scenarios, and if you have any special requirements,

CodePudding user response:

Because this figure is such a string argument,
 
String a="today" + to_string (timeDest. WYear) + "years" + (timeDest. WMonth & gt; 9? "" :" 0 ") + to_string (timeDest. WMonth) + "month" + (timeDest. WDay & gt; 9? "" :" 0 ") + to_string (timeDest. WDay) + number "XianFaJuShi reply";

Digital simulation (a);

CodePudding user response:

Digital simulation was added to output characters, it was a bit of stick related.

CodePudding user response:

reference gouyanfen reply: 3/f
this to see what code you use, not sure coding can't determine the rules of

GBK

CodePudding user response:

Draw a state machine, it should be clear, and I think it's Chinese characters in the case of the application of the computer that accessible, should be completely ready library,

CodePudding user response:

Read a post, might as well turn the

CodePudding user response:

the wise know already, 9/f, reference shall be good karma response:
read a post, might as well turn the

Thank you, look not to understand

CodePudding user response:

If use natural language description,
After reading one character at a time, when dealing with the next character, if high for 1 byte, continue with the next byte, character read finished,
If high is 0, direct press single-byte character processing, processed characters,
Repeat the above process,,,,,,,
Roughly as follows
 char STR []="ha ha 1 hello 23"; 
Char * p=STR.
While (* p!='\ 0')
{
Char hz [3]={0};
If (* p& 0 x80)
{
Hz [0]=* p;
Printf (" high coding: % x | ", (* p) & amp; 0 x000000ff);
p++;
Hz [1]=* p;
Printf (" x "at the end of a code: %, (* p) & amp; 0 x000000ff);
Printf (" \ n \ t characters: % s ", hz);
}
The else
{
Ed: printf (" % \ t characters: x % c \ n ", * p, * p).
}
p++;
}

CodePudding user response:

High code: b9 | at the end of a code: fe characters:
High code: b9 | at the end of a code: fe characters:
Ed: 31 characters: 1
High coding: end of c4 | code: e3 characters: you
High code: ba | at the end of a code: c3 character: good
Ed: 32 characters: 2
Ed: 33 characters: 3

CodePudding user response:

Look at the previous post says from the text to read, didn't say more Chinese to do?
  • Related