How to understand encoding: 1. Base64 is one of the most common encoding methods used to transmit 8Bit bytecode on the Internet. Base64 is a method of representing binary data based on 64 printable characters; 2. [UTF-8] is a variable-length character encoding for Unicode, also known as Unicode.
How to understand coding:
Coding is mainly divided into two parts
Base64 is one of the most common encoding methods for transmitting 8Bit bytecode on the Internet. Base64 is a method of representing binary data based on 64 printable characters.
UTF-8 (8-bit Unicode Transformation Format) is a variable-length character encoding for Unicode, also known as Unicode. Created by Ken Thompson in 1992. It is now standardized as RFC 3629. UTF-8 encodes Unicode characters using 1 to 6 bytes. Used on web pages, the page can display simplified, traditional, and other languages (such as English, Japanese, Korean) in a unified manner.
utf-8 is an encoding method of unicode (the character "I" after unicode encoding is \u6211 \u represents Chinese, 6211 is the binary data of this character in the comparison table displayed in hexadecimal) , is the expression of characters, such as what kind of binary represents what kind of characters, there is a comparison table, base64 is a binary encoding that facilitates transmission. For example, when transmitting a picture, you can encode the binary base64 of the picture and pass it through parameters. For other recipients, it is not the same concept.
UrlEncode Convert the characters that need to be transcoded into hexadecimal, and then take 4 digits from right to left (less than 4 digits will be processed directly), and do one for every 2 digits. Bit, preceded by %, is encoded in %XY format. (This also involves what kind of encoding method to use, generally utf-8. The encoding method determines what kind of binary it is converted into, and then it is converted into hexadecimal through urlencode, and % is added according to the rules) The encoded result is more suitable for network transmission. Same as base64, but base64 is only responsible for binary encoding
urlencode encoding/urldecode decoding
Convert the characters that need to be transcoded into hexadecimal (using UTF-8 Or unicode encoding comparison table such as gb2312), then take 4 digits from right to left (less than 4 digits are processed directly), make one digit for every 2 digits, add % in front, and encode it into %XY format.
For example: the ASCII code of a space is 32, and the corresponding hexadecimal value is 20, then the urlencode encoding result is: , but in the new standard, the corresponding space is, see RFC-1738
For example: The ASCII code is -10544, and the corresponding hexadecimal is FFFFFFFFFFFFD6D0. Then the urlencode encoding result is: ��
What encoding does the browser use? When the server returns, tell the browser what encoding to use (response.setContentType( "text/html;charset=UTF-8");), when the browser makes a request, it will also encode the content of this request, such as Chinese, according to the encoding method returned last time
If you want to learn more about programming, please pay attention to the php training column!
The above is the detailed content of How to understand coding. For more information, please follow other related articles on the PHP Chinese website!

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

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

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment