当前位置:网站首页>[character set 7] what are the wide character codes and multi byte codes of Chinese characters
[character set 7] what are the wide character codes and multi byte codes of Chinese characters
2022-06-12 08:52:00 【junxuezheng】
Here's the catalog title
One 、 The nature of wide and multibyte characters
stay windows The system is set up utf8 when ,char It uses utf8 Character set , When not set ,char Used gbk Character set . And below char Is the use of the gbk Character set .
char ch[] = “ I ”;
wchar_t wch[] = L" I ";.
- Multibyte characters are gbk character
- Wide byte characters are Unicode character
- remarks : We know gbk Is a multibyte character , As for why to convert to wide characters , Namely Unicode code , It may be the default .
Two 、 What are the wide character codes and multi byte codes for Chinese characters
- gbk:GBK code 、 Chinese character coding GBK code ( Complete code table attached )
- Chinese characters “ I ”:CED2 It's hexadecimal . The corresponding decimal system is 52946.
- Unicode: https://unicode-table.com/cn/
- Chinese characters “ I ”:6211 It's hexadecimal . The corresponding decimal system is 25105.

3、 ... and 、demo
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define BUFFER_SIZE 50
using namespace std;
int main()
{
setlocale(LC_ALL, "chs");
char mbyte[50];
wchar_t * wbyte =NULL;
strcpy(mbyte, " I ");
size_t mlen = strlen(mbyte);
int dSize = mbstowcs(wbyte, mbyte, 0) + 1;
wbyte = new wchar_t[dSize];
wmemset(wbyte, 0, dSize);
int len = mbstowcs(wbyte, mbyte, mlen);
cout << &mbyte<<endl;
wcout << &wbyte << endl;
cout << mbyte << endl;
wcout << wbyte << endl;
return(0);
}
- Output
00F3F984
00F3F978
I
I
remarks :00F3F978 Is the pointer address , You should look at the address pointed to by the pointer . As shown in the figure below, the value is 0x013107E8. Address 0x013107E8 The value stored in is 6211( Here's the picture )
- View Chinese characters “ I ” Of gbk The code value is CED2( Hexadecimal )、Unicode The encoding value of 6211( Hexadecimal )
https://blog.csdn.net/u010025662/article/details/54933530
边栏推荐
- 【字符集六】宽字符串和多字节字符互转
- 2022.6.11-----leetcode. nine hundred and twenty-six
- Code generation tool Autocode for XML Publishing
- QT realizes multi screen and multi-resolution adaptation
- Binlog in mysql:
- Encapsulate the amount input box component.
- Wechat applet image saving function
- Construction of memcached cache service under Linux:
- MES helps enterprises to transform intelligently and improve the transparency of enterprise production
- Implementing architecture caching in MySQL under redis server environment
猜你喜欢

Redis installation test

Oracle installation details (verification)

分库分表会带来读扩散问题?怎么解决?

【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C

Webrtc series - mobile terminal hardware coding supports simulcast

Centso8 installing mysql8.0 (Part 2)

Composition of box model

Background location case II

(p21-p24) unified data initialization method: List initialization, initializing objects of non aggregate type with initialization list, initializer_ Use of Lisy template class

The era of post MES system has come gradually
随机推荐
【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C
Never use MES as a tool, or you will miss the most important thing
动态创建表单并提交
Configuration and principle of MSTP
Convert spaces to < br / > newline labels
(P13) use of final keyword
利用nvm动态调整nodejs版本,解决因为node版本过高或过低导致项目无法运行和打包
Loading font component loading effect
Knee joint
(P14) use of the override keyword
【新规划】
Set up redis sentinel cluster (instance):
Regular verification user name
[open source project] easycmd command graphical software
Redis installation test
QT realizes multi screen and multi-resolution adaptation
torch. logical_ And() method
Seurat package addmodulescore is used for bulk RNA SEQ data
Shell basic syntax -- array
Dynamically create and submit forms


