一、GB2312-80介绍
GB2312码是中华人民共和国国家汉字信息交换用编码,全称《信息交换用汉字编码字符集--基本集》,由国家标准总局发布,1981年5月1日实施,通行于大陆。新加坡等地也使用此编码。
GB2312收录简化汉字及符号、字母、日文假名等共7445个图形字符,其中汉字占6763个。GB2312规定“对任意一个图形字符都采用两个字节表示,每个字节均采用七位编码表示”,习惯上称第一个字节为“高字节”,第二个字节为“低字节”。GB2312-80包含了大部分常用的一、二级汉字,和9区的符号。该字符集是几乎所有的中文系统和国际化的软件都支持的中文字符集,这也是最基本的中文字符集。其编码范围是高位0xa1-0xfe,低位也是0xa1-0xfe;汉字从0xb0a1开始,结束于0xf7fe。
GB2312将代码表分为94个区,对应第一字节(0xa1-0xfe);每个区94个位(0xa1-0xfe),对应第二字节,两个字节的值分别为区号值和位号值加32(2OH),因此也称为区位码。01-09区为符号、数字区,16-87区为汉字区(0xb0-0xf7),10-15区、88-94区是有待进一步标准化的空白区。GB2312将收录的汉字分成两级:第一级是常用汉字计3755个,置于16-55区,按汉语拼音字母/笔形顺序排列;第二级汉字是次常用汉字计3008个,置于56-87区,按部首/笔画顺序排列。故而GB2312最多能表示6763个汉字。
GB2312的编码范围为2121H-777EH,与ASCII有重叠,通行方法是将GB码两个字节的最高位置1以示区别。
图1:GB2312编码图
图中位于ASCII区中的虚线区域即为原GB2312编码区域,右下角实线区域为平移后的GB2312编码区域。
二、GB2312-80的扩展
GBK是GB2312-80的扩展,是向上兼容的。它包含了20902个汉字,其编码范围是0x8140-0xfefe,剔除高位0x80的字位。其所有字符都可以一对一映射到Unicode2.0。
GB18030-2000(GBK2K)在GBK的基础上进一步扩展了汉字,增加了藏、蒙等少数民族的字形。GBK2K从根本上解决了字位不够,字形不足的问题。它有几个特点:
l 它并没有确定所有的字形,只是规定了编码范围,留待以后扩充。
l 编码是变长的,其二字节部分与GBK兼容;四字节部分是扩充的字形、字位,其编码范围是首字节0x81-0xfe、二字节0x30-0x39、三字节0x81-0xfe、四字节0x30-0x39。
l 它的推广是分阶段的,首先要求实现的是能够完全映射到Unicode3.0标准的所有字形。
l 它是国家标准,是强制性的。
l 现在还没有任何一个操作系统或软件实现了GBK2K的支持,这是现阶段和将来汉化的工作内容。
三、Unicode编码
国际标准组织于1984年4月成立ISO/IECJTC1/SC2/WG2工作组,针对各国文字、符号进行统一性编码。1991年美国跨国公司成立UnicodeConsortium,并于1991年10月与WG2达成协议,采用同一编码字集。目前Unicode是采用16位编码体系,其字符集内容与ISO10646的BMP(BasicMultilingualPlane)相同。Unicode于1992年6月通过DIS(DrafInternationalStandard),目前版本V2.0于1996公布,内容包含符号6811个,汉字20902个,韩文拼音11172个,造字区6400个,保留20249个,共计65534个。
随着国际互联网的迅速发展,要求进行数据交换的需求越来越大,不同的编码体系越来越成为信息交换的障碍,而且多种语言共存的文档不断增多,单靠代码页已很难解决这些问题,于是UNICODE应运而生。
UNICODE有双重含义,首先UNICODE是对国际标准ISO/IEC10646编码的一种称谓(ISO/IEC10646是一个国际标准,亦称大字符集,它是ISO于1993年颁布的一项重要国际标准,其宗旨是全球所有文种统一编码),另外它又是由美国的HP、Microsoft、IBM、Apple等大企业组成的联盟集团的名称,成立该集团的宗旨就是要推进多文种的统一编码。
UNICODE同现在流行的代码页最显著不同点在于:UNICODE是两字节的全编码,对于ASCII字符它也使用两字节表示。代码页是通过高字节的取值范围来确定是ASCII字符,还是汉字的高字节。如果发生数据损坏,某处内容破坏,则会引起其后汉字的混乱。UNICODE则一律使用两个字节表示一个字符,最明显的好处是它简化了汉字的处理过程。
UNICODE使用平面来描述编码空间,每个平面分为256行,256列,相对于两字节编码的高低两个字节。
UNICODE的第一个平面,称为BasicMultilingualPlane(基本多文种平面),简称BMP,由于BMP仅用两个字节表示,所以倍受青睐。
图2:BMP的最新概貌图
其中A_ZONE为拼音文字编码区,拉丁文、阿拉伯文、日文的平假名及片假名等都在此区编码。CJKExtensionA和CJK为汉字区域共计27487个汉字。Y1即彝文,位于O-ZONE保留待将来使用。Hangul即韩文。EUDC为用户私有区,用户可以根据需要自己定义此区的编码。R-ZONE为限制使用区,一些兼容字符、特殊字符均放在此区。
UNICODE定义BMP中的D800-DFFF为代理区(SurrogateZone),其中D800-D8FF为高半代理(highsurrogate),DC00-DFFF为低半代理(lowsurrogate)。从两个区域分别取一个编码,组成一个4字节的代理对来表示一个编码字符,此即为UTF-16。利用UTF-16机制,UNICODE扩充了1024*1024个字符,相应于OO-OF平面,并且将02平面分配给了CJKExtensionB。Microsoft在Windows2000已实现了UTF-16。
Unicode编码布局
0000..007F;BasicLatin
0080..00FF;Latin-1Supplement
0100..017F;LatinExtended-A
0180..024F;LatinExtended-B
0250..02AF;IPAExtensions
02B0..02FF;SpacingModifierLetters
0300..036F;CombiningDiacriticalMarks
0370..03FF;GreekandCoptic
0400..04FF;Cyrillic
0500..052F;CyrillicSupplementary
0530..058F;Armenian
0590..05FF;Hebrew
0600..06FF;Arabic
0700..074F;Syriac
0780..07BF;Thaana
0900..097F;Devanagari
0980..09FF;Bengali
0A00..0A7F;Gurmukhi
0A80..0AFF;Gujarati
0B00..0B7F;Oriya
0B80..0BFF;Tamil
0C00..0C7F;Telugu
0C80..0CFF;Kannada
0D00..0D7F;Malayalam
0D80..0DFF;Sinhala
0E00..0E7F;Thai
0E80..0EFF;Lao
0F00..0FFF;Tibetan
1000..109F;Myanmar
10A0..10FF;Georgian
1100..11FF;HangulJamo
1200..137F;Ethiopic
13A0..13FF;Cherokee
1400..167F;UnifiedCanadianAboriginalSyllabics
1680..169F;Ogham
16A0..16FF;Runic
1700..171F;Tagalog
1720..173F;Hanunoo
1740..175F;Buhid
1760..177F;Tagbanwa
1780..17FF;Khmer
1800..18AF;Mongolian
1E00..1EFF;LatinExtendedAdditional
1F00..1FFF;GreekExtended
2000..206F;GeneralPunctuation
2070..209F;SuperscriptsandSubscripts
20A0..20CF;CurrencySymbols
20D0..20FF;CombiningDiacriticalMarksforSymbols
2100..214F;LetterlikeSymbols
2150..218F;NumberForms
2190..21FF;Arrows
2200..22FF;MathematicalOperators
2300..23FF;MiscellaneousTechnical
2400..243F;ControlPictures
2440..245F;OpticalCharacterRecognition
2460..24FF;EnclosedAlphanumerics
2500..257F;BoxDrawing
2580..259F;BlockElements
25A0..25FF;GeometricShapes
2600..26FF;MiscellaneousSymbols
2700..27BF;Dingbats
27C0..27EF;MiscellaneousMathematicalSymbols-A
27F0..27FF;SupplementalArrows-A
2800..28FF;BraillePatterns
2900..297F;SupplementalArrows-B
2980..29FF;MiscellaneousMathematicalSymbols-B
2A00..2AFF;SupplementalMathematicalOperators
2E80..2EFF;CJKRadicalsSupplement
2F00..2FDF;KangxiRadicals
2FF0..2FFF;IdeographicDescriptionCharacters
3000..303F;CJKSymbolsandPunctuation
3040..309F;Hiragana
30A0..30FF;Katakana
3100..312F;Bopomofo
3130..318F;HangulCompatibilityJamo
3190..319F;Kanbun
31A0..31BF;BopomofoExtended
31F0..31FF;KatakanaPhoneticExtensions
3200..32FF;EnclosedCJKLettersandMonths

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft