CSAPP Chapter2 Representing and Manipulating Information node1

本文详细介绍了字符编码如ASCII、Unicode及UTF-8的基本概念,并解释了它们之间的区别。此外,还深入探讨了小端和大端字节序的概念及其在十六进制数值中的表现形式。

C String:

declare:
<span style="font-family:Comic Sans MS;">const char *s = "abcdef";</span>
String in C is a char array ending with null,whose ASCII is 0.
strlen(s) return the length not include null.

Order the bytes representing an object:

when presenting a hexadecimal value of 0x01234567
little endian: 67 45 23 01
big endian:       01 23 45 67

ASCII、unicode、UTF-

ASCII: only suitable for English text. 1 byte for a char.
unicode: cover most human languages and signal, a signal set.Only tell you what a char's binary code is, doesn't tell you how to store it.
UTF-8: one of implements of unicode, variable length(1~4bytes),if a char can be represented by ASCII, its code in UTF-8 is the same as in ASCII.

standand for UTF-8

range | binary code
0000 0000-0000 007F | 0xxxxxxx
0000 0080-0000 07FF | 110xxxxx 10xxxxxx
0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值