(2)Encoding BASE64 Code =padding characters might be added to make the last encoded block contain four Base64 characters.If there are only two significant input octets (e.g.,'Ma'),or when the last input group contains only two octets,all 16 bits will be captured in the first three Base64 digits (18bits);the two least significant bits of the last content-bearing 6-bit block will turn out to be zero,and discarded on decoding (along with the following padding characters):
(2)Encoding =, padding characters might be added to make the last encoded block contain four Base64 characters. If there are only two significant input octets (e.g., 'Ma'), or when the last input group contains only two octets, all 16 bits will be captured in the first three Base64 digits (18bits); the two least significant bits of the last content-bearing 6-bit block will turn out to be zero, and discarded on decoding (along with the following = padding characters): BASE64 Code
(2)Encoding BASE64 Code Text M a Source (ASCII) Octets 77(0x4d) 97(0x61) Bits 010011010110000100 Sextets 19 22 4 Padding Base64 Look up table... encoded Character T W E Octets 84(0x54) 87(0x57) 69(0x45) 61(0x3D)
(2)Encoding BASE64 Code Source Text (ASCII) M a Octets 77 (0x4d) 97 (0x61) Bits 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 0 Base64 encoded Sextets 19 22 4 Padding Look up table… Character T W E = Octets 84 (0x54) 87 (0x57) 69 (0x45) 61 (0x3D)
(2)Encoding BASE64 Code If there is only one significant input octet (e.g.,'M),or when the last input group contains only one octet,all 8 bits will be captured in the first two Base64 digits(12 bits);the four least significant bits of the last content- bearing 6-bit block will turn out to be zero,and discarded on decoding (along with the following padding characters)
(2)Encoding If there is only one significant input octet (e.g., 'M'), or when the last input group contains only one octet, all 8 bits will be captured in the first two Base64 digits (12 bits); the four least significant bits of the last contentbearing 6-bit block will turn out to be zero, and discarded on decoding (along with the following = padding characters): BASE64 Code
(2)Encoding BASE64 Code Text M Source (ASCII) Octets 77(0x4d Bits 010011010000 Sextets 19 16 Padding Padding Look up table... Base64 encoded Character T Q Octets 84(0x54) 81(0x51) 61(0x3D) 61(0x3D) Note:the final =sequence indicates that the last group contained two bytes,and indicates that it contained only one byte!
(2)Encoding BASE64 Code Source Text (ASCII) M Octets 77 (0x4d) Bits 0 1 0 0 1 1 0 1 0 0 0 0 Base64 encoded Sextets 19 16 Padding Padding Look up table… Character T Q = = Octets 84 (0x54) 81 (0x51) 61 (0x3D) 61 (0x3D) Note: the final = = sequence indicates that the last group contained two bytes, and = indicates that it contained only one byte!
(2)Encoding Unicode Unicode:编码把所有语言中的字符都统一到一套编码里,这样就不 会再有乱码问题了。Unicode标准也在不断发展,但最常用的是用 两个字节表示一个字符(如果要用到非常偏僻的字符,就需要4个 字节)。如果统一成Unicode编码,乱码问题从此消失了。但是, 如果你写的文本基本上全部是英文的话,用Unicode编码比ASCII 编码需要多一倍的存储空间,在存储和传输上就十分不划算。所 以,本着节约的精神,又出现了把Unicode编码转化为“可变长编 码”的UTF-8编码。UTF-8编码把一个Unicode字符根据不同的数字 大小编码成1-6个字节,常用的英文字母被编码成1个字节(ASCII 码),汉字通常是2个字节,只有很生僻的字符才会被编码成4-6 个字节。如果你要传输的文本包含大量英文字符,用UT℉-8编码就 能节省空间。 例如汉子“安徽”的Unicode:编码为u5b89u5fbd Unicodes编码转换可参见: http://tool.chinaz.com/Tools/Unicode.aspx
(2)Encoding Unicode Unicode编码转换可参见: http://tool.chinaz.com/Tools/Unicode.aspx Unicode编码把所有语言中的字符都统一到一套编码里,这样就不 会再有乱码问题了。Unicode标准也在不断发展,但最常用的是用 两个字节表示一个字符(如果要用到非常偏僻的字符,就需要4个 字节)。如果统一成Unicode编码,乱码问题从此消失了。但是, 如果你写的文本基本上全部是英文的话,用Unicode编码比ASCII 编码需要多一倍的存储空间,在存储和传输上就十分不划算。所 以,本着节约的精神,又出现了把Unicode编码转化为“可变长编 码”的UTF-8编码。UTF-8编码把一个Unicode字符根据不同的数字 大小编码成1-6个字节,常用的英文字母被编码成1个字节(ASCII 码),汉字通常是2个字节,只有很生僻的字符才会被编码成4-6 个字节。如果你要传输的文本包含大量英文字符,用UTF-8编码就 能节省空间。 例如汉子“安徽”的Unicode编码为\u5b89\u5fbd