Null characterThe null character is a control character with the value zero.[1][2][3][4][5] Many character sets include a code point for a null character – including Unicode (Universal Coded Character Set), ASCII (ISO/IEC 646), Baudot, ITA2 codes, the C0 control code, and EBCDIC. In modern character sets, the null character has a code point value of zero which is generally translated to a single code unit with a zero value. For instance, in UTF-8, it is a single, zero byte. However, in Modified UTF-8 the null character is encoded as two bytes : 0xC0,0x80. This allows the byte with the value of zero, which is not used for any character, to be used as a string terminator. Originally, its meaning was like NOP – when sent to a printer or a terminal, it had no effect (although some terminals incorrectly displayed it as space). When electromechanical teleprinters were used as computer output devices, one or more null characters were sent at the end of each printed line to allow time for the mechanism to return to the first printing position on the next line.[citation needed] On punched tape, the character is represented with no holes at all, so a new unpunched tape is initially filled with null characters, and often text could be inserted at a reserved space of null characters by punching the new characters into the tape over the nulls. A null-terminated string is a commonly used data structure in the C programming language, its many derivative languages and other programming contexts that uses a null character to indicate the end of a string.[6][7] This design allows a string to be any length at the cost of only one extra character of memory. The common competing design for a string stores the length of the string as an integer data type, but this limits the size of the string to the range of the integer (for example, 255 for a byte). For byte storage, the null character can be called a null byte. RepresentationSince the null character is not a printable character representing it requires special notation in source code. In a string literal, the null character is often represented as the escape sequence A null character can be placed in a URL with the percent code The ability to represent a null character does not always mean the resulting string will be correctly interpreted, as many programs will consider the null to be the end of the string. Thus, the ability to type it (in case of unchecked user input) creates a vulnerability known as null byte injection and can lead to security exploits.[10] In software documentation, the null character is often represented with the text NUL (or NULL although that may mean the null pointer). In Unicode, there is a character for this: U+2400 ␀ SYMBOL FOR NULL. In caret notation the null character is References
External links
|
Portal di Ensiklopedia Dunia