2819 views|6 replies

389

Posts

0

Resources
The OP
 

Questions about encoding format [Copy link]

1. Test environment: VS2015

2. The test code is as follows:

char	*pweb_namec = "C语言中文";

printf("C语言中文的 内存形式:\r\n");
printf("char2 hex1:%#x\r\n", (unsigned char)*pweb_namec++);//0x43
printf("char2 hex2:%#x\r\n", (unsigned char)*pweb_namec++);//0xD3
printf("char2 hex3:%#x\r\n", (unsigned char)*pweb_namec++);//0xEF
printf("char2 hex4:%#x\r\n", (unsigned char)*pweb_namec++);//0xD1
printf("char2 hex5:%#x\r\n", (unsigned char)*pweb_namec++);//0xD4
printf("char2 hex6:%#x\r\n", (unsigned char)*pweb_namec++);//0xD6
printf("char2 hex7:%#x\r\n", (unsigned char)*pweb_namec++);//0xD0

Find out the following information:

The GBK internal code of "语" is D3EF and
the GBK internal code of "言" is D1D4

3. Question: Logically, the storage mode of a PC should be little-endian, but why is it shown as big-endian here?

This post is from Programming Basics

Latest reply

I'm not really sure about this. Usually when I encounter this kind of big-endian and small-endian problem, if one doesn't work, I'll try another one. Anyway, there's not much point in delving into these two modes.   Details Published on 2020-9-27 21:23
 

78

Posts

0

Resources
2
 

Very good talk, I gained a lot from reading it, thank you very much

This post is from Programming Basics

Comments

Thanks for your attention, I am actually asking a question  Details Published on 2020-9-20 22:56
 
 
 

389

Posts

0

Resources
3
 
Method Ou Jin published on 2020-9-20 12:39 It was very well said. I gained a lot from reading it. Thank you very much

Thanks for your attention, I am actually asking a question

This post is from Programming Basics
 
 
 

7462

Posts

2

Resources
4
 

It seems to be a problem, I never noticed it. . .

This post is from Programming Basics

Comments

So could you help me figure it out?  Details Published on 2020-9-25 11:04
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

389

Posts

0

Resources
5
 
freebsder posted on 2020-9-21 20:39 It seems to be a problem,,, I never noticed it. . .

So could you help me figure it out?

This post is from Programming Basics

Comments

I'm not really sure about this. Usually when I encounter this kind of big-endian and small-endian problem, if one doesn't work, I'll try another one. There are only two modes anyway, so there's not much point in delving into it.  Details Published on 2020-9-27 21:23
 
 
 

7462

Posts

2

Resources
6
 
yaoyong posted on 2020-9-25 11:04 So can you help me answer this question?

I'm not really sure about this. Usually when I encounter this kind of big-endian and small-endian problem, if one doesn't work, I'll try another one. Anyway, there's not much point in delving into these two modes.

This post is from Programming Basics

Comments

Okay, thank you.  Details Published on 2020-9-29 12:18
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

389

Posts

0

Resources
7
 
freebsder posted on 2020-9-27 21:23 I'm not sure about this. I usually encounter this kind of big-endian problem. If this one doesn't work, I'll change it. Anyway, there are only two modes. There's not much point in going into it...

Okay, thank you.

This post is from Programming Basics
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list