虽然我能够从维基百科理解编码和解码的含义,但我无法理解为什么每种编程语言都需要它们?如果答案与能够从数据库等外部源读取数据有关,那么为什么其中许多采用不同的编码方案?
Ex Python 有一个默认的 ASCII 编码
Java 依赖于底层操作系统,
DB2 数据库有 IBM-1252
虽然我能够从维基百科理解编码和解码的含义,但我无法理解为什么每种编程语言都需要它们?如果答案与能够从数据库等外部源读取数据有关,那么为什么其中许多采用不同的编码方案?
Ex Python 有一个默认的 ASCII 编码
Java 依赖于底层操作系统,
DB2 数据库有 IBM-1252
大多数人喜欢使用文本。
但是,计算机存储只能使用字节。
编码是将文本转换为字节的过程。
在过去的几十年中,已经为不同的目的开发了许多不同的编码方案,例如简洁、兼容性或国际化。
今天,一切都应该简单地使用 UTF8。(可悲的是,并非一切都如此)
Programmer and user interact with simple plain text format in form of English or other human readable language but computer do not know how to deal with that.Computer can only deal with bytes so Encoding and decoding is necessary.
Quoted from http://searchnetworking.techtarget.com/definition/encoding-and-decoding:
In computers, encoding is the process of putting a sequence of characters (letters, numbers, punctuation, and certain symbols) into a specialized format for efficient transmission or storage. Decoding is the opposite process -- the conversion of an encoded format back into the original sequence of characters. Encoding and decoding are used in data communications, networking, and storage. The term is especially applicable to radio (wireless) communications systems.
The terms encoding and decoding are often used in reference to the processes of analog-to-digital conversion and digital-to-analog conversion. In this sense, these terms can apply to any form of data, including text, images, audio, video, multimedia, computer programs, or signals in sensors, telemetry, and control systems. Encoding should not be confused with encryption, a process in which data is deliberately altered so as to conceal its content. Encryption can be done without changing the particular code that the content is in, and encoding can be done without deliberately concealing the content.
The code used by most computers for text files is known as ASCII (American Standard Code for Information Interchange, pronounced ASK-ee). ASCII can depict uppercase and lowercase alphabetic characters, numerals, punctuation marks, and common symbols. Other commonly-used codes include Unicode, BinHex, Uuencode, and MIME. In data communications, Manchester encoding is a special form of encoding in which the binary digits (bits) represent the transitions between high and low logic states. In radio communications, numerous encoding and decoding methods exist, some of which are used only by specialized groups of people (amateur radio operators, for example). The oldest code of all, originally employed in the landline telegraph during the 19th century, is the Morse code.