Misplaced Pages

MARC-8

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

The MARC-8 charset is a MARC standard used in MARC-21 library records. The MARC formats are standards for the representation and communication of bibliographic and related information in machine-readable form, and they are frequently used in library database systems . The character encoding now known as MARC-8 was introduced in 1968 as part of the MARC format. Originally based on the Latin alphabet , from 1979 to 1983 the JACKPHY initiative expanded the repertoire to include Japanese, Arabic, Chinese, and Hebrew characters (among others), with the later addition of Cyrillic and Greek scripts. If a character is not representable in MARC-8 of a MARC-21 record, then UTF-8 must be used instead. UTF-8 has support for many more characters than MARC-8, which is rarely used outside library data.

#559440

97-572: MARC-8 uses a variant of the ISO-2022 encoding. It uses escape characters to represent characters beyond the 7-bit ASCII range of characters. It generally uses the same logical BiDi ordering as Unicode . The combining characters and base characters are in a different order than used in Unicode. The following are some examples. The combining characters are not always stored in reverse order as Unicode normalization . The MARC-21 standard describes

194-442: A UNIX shell script written in a Windows text editor like Notepad ). The concepts of carriage return (CR) and line feed (LF) are closely associated and can be considered either separately or together. In the physical media of typewriters and printers , two axes of motion, "down" and "across", are needed to create a new line on the page . Although the design of a machine (typewriter or printer) must consider them separately,

291-514: A 7-bit or 8-bit environment), but not both. Which style of C1 invocation is used must be specified in the definition of the code version. For example, ISO/IEC 4873 specifies CR bytes for the C1 controls which it uses (SS2 and SS3). If necessary, which invocation is used may be communicated using announcer sequences . In the latter case, single control functions from the C1 control code set are invoked using "type Fe" escape sequences, meaning those where

388-405: A device driver to translate this character to whatever sequence a printer needed (including extra padding characters ), and the single byte was more convenient for programming. What seems like a more obvious choice— CR —was not used, as CR provided the useful function of overprinting one line with another to create boldface , underscore and strikethrough effects. Perhaps more importantly,

485-483: A file, e.g. some configuration file, encoded using the foreign newline convention, as a valid file. The problem can be hard to spot because some programs handle the foreign newlines properly while others do not. For example, a compiler may fail with obscure syntax errors even though the source file looks correct when displayed on the console or in an editor . Modern text editors generally recognize all flavours of CR + LF newlines and allow users to convert between

582-770: A file. Some languages have created special variables , constants , and subroutines to facilitate newlines during program execution. In some languages such as PHP and Perl , double quotes are required to perform escape substitution for all escape sequences, including '\n' and '\r' . In PHP, to avoid portability problems, newline sequences should be issued using the PHP_EOL constant. Example in C# : The different newline conventions cause text files that have been transferred between systems of different types to be displayed incorrectly. Text in files created with programs which are common on Unix-like or classic Mac OS , appear as

679-434: A full line that automatically add the native newline sequence, and functions for reading lines that accept any of CR , LF , or CR + LF as a line terminator (see BufferedReader.readLine() ). The System.lineSeparator() method can be used to retrieve the underlying line separator. Example: Python permits "Universal Newline Support" when opening a file for reading, when importing modules, and when executing

776-515: A graphical set designation sequence, if the second I byte (for a single-byte set) or the third I byte (for a double-byte set) is 0x20 (space), the set denoted is a " dynamically redefinable character set " (DRCS) defined by prior agreement, which is also considered private use. A graphical set being considered a DRCS implies that it represents a font of exact glyphs, rather than a set of abstract characters. The manner in which DRCS sets and associated fonts are transmitted, allocated and managed

873-438: A line break is required independent of whether the next word would fit on the same line, such as between paragraphs and in vertical lists. Therefore, in the logic of word processing and most text editors , newline is used as a paragraph break and is known as a "hard return", in contrast to "soft returns" which are dynamically created to implement word wrapping and are changeable with each display instance. In many applications

970-555: A line. Furthermore, the escape sequences declaring the national character sets may be absent if a specific ISO-2022-based encoding permits or requires this, and dictates that particular national character sets are to be used. For example, ISO-8859-1 states that no defining escape sequence is needed. To represent large character sets, ISO/IEC 2022 builds on ISO/IEC 646 's property that a seven-bit character representation will normally be able to represent 94 graphic (printable) characters (in addition to space and 33 control characters); if only

1067-465: A multiple byte escape sequence consisting of the escape character, an Intermediate character sequence, and a Final character in the form ESC I F . The following table shows the intermediate byte after the ESC byte (hexadecimal 1B), and the corresponding ASCII characters. The following table shows the final bytes in hexadecimal and the corresponding ASCII characters after the intermediate bytes. The EACC

SECTION 10

#1732780871560

1164-408: A newline is considered a separator, there will be no newline after the last line of a file. Some programs have problems processing the last line of a file if it is not terminated by a newline. On the other hand, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line. Conversely, if a newline is considered a terminator, all text lines including

1261-414: A separate control character called "manual line break" exists for forcing line breaks inside a single paragraph. The glyph for the control character for a hard return is usually a pilcrow (¶), and for the manual line break is usually a carriage return arrow (↵). RI ( U +008D REVERSE LINE FEED , ISO/IEC 6429 8D, decimal 141) is used to move the printing position back one line (by reverse feeding

1358-469: A sequence of characters, is used to signify the end of a line of text and the start of a new one. In the mid-1800s, long before the advent of teleprinters and teletype machines, Morse code operators or telegraphists invented and used Morse code prosigns to encode white space text formatting in formal written text messages. In particular, the Morse prosign BT (mnemonic break text), represented by

1455-449: A single byte, regardless of the number of bytes used for graphical characters. CJK encodings used in 7-bit environments which use ISO 2022 mechanisms to switch between character sets are often given names starting with "ISO-2022-", most notably ISO-2022-JP , although some other CJK encodings such as EUC-JP also make use of ISO 2022 mechanisms. Since the first 256 code points of Unicode were taken from ISO 8859-1 , Unicode inherits

1552-410: A single character (e.g. LF ), because Unicode is designed to preserve all information when converting a text file from any existing encoding to Unicode and back ( round-trip integrity ), Unicode needs to make the same distinctions between line breaks made by other encodings. For example: NL is part of EBCDIC , which uses code 0x15 ; it is normally mapped to Unicode NEL , 0x85 , which

1649-450: A single long line on most programs common to MS-DOS and Microsoft Windows because these do not display a single line feed or a single carriage return as a line break. Conversely, when viewing a file originating from a Windows computer on a Unix-like system, the extra CR may be displayed as a second line break, as ^M , or as <cr> at the end of each line. Furthermore, programs other than text editors may not accept

1746-634: A standard document; however, registration does not create a new ISO standard, does not commit the ISO or IEC to adopt it as an international standard, and does not commit the ISO or IEC to add any of its characters to the Universal Coded Character Set . ISO-IR registered escape sequences are also used encapsulated in a Formal Public Identifier to identify character sets used for numeric character references in SGML (ISO 8879). For example,

1843-563: A syntax for escape sequences, multiple-byte sequences beginning with the ESC control code, which can likewise be used for in-band instructions. Specific sets of control codes and escape sequences designed to be used with ISO 2022 include ISO/IEC 6429 , portions of which are implemented by ANSI.SYS and terminal emulators . ISO 2022 itself also defines particular control codes and escape sequences which can be used for switching between different coded character sets (for example, between ASCII and

1940-444: A user-visible character to the reader of the document, and are thus not recognized themselves as a newline. To facilitate creating portable programs, programming languages provide some abstractions to deal with the different types of newline sequences used in different environments. The C language provides the escape sequences '\n' (newline) and '\r' (carriage return). However, these are not required to be equivalent to

2037-494: Is a control character in the C1 control set . As such, it is defined by ECMA 48, and recognized by encodings compliant with ISO/IEC 2022 (which is equivalent to ECMA 35). C1 control set is also compatible with ISO-8859-1 . The approach taken in the Unicode standard allows round-trip transformation to be information-preserving while still enabling applications to recognize all possible types of line terminators. Recognizing and using

SECTION 20

#1732780871560

2134-810: Is an ISO / IEC standard in the field of character encoding . It is equivalent to the ECMA standard ECMA-35 , the ANSI standard ANSI X3.41 and the Japanese Industrial Standard JIS X 0202 . Originating in 1971, it was most recently revised in 1994. ISO 2022 specifies a general structure which character encodings can conform to, dedicating particular ranges of bytes ( 0x 00–1F and 0x7F–9F) to be used for non-printing control codes for formatting and in-band instructions (such as line breaks or formatting instructions for text terminals ), rather than graphical characters . It also specifies

2231-459: Is available on virtually every Unix-like system and can be used to perform arbitrary replacement operations on single characters. A DOS/Windows text file can be converted to Unix format by simply removing all ASCII CR characters with or, if the text has only CR newlines, by converting all CR newlines to LF with The same tasks are sometimes performed with awk , sed , or in Perl if

2328-659: Is in turn conformed to by ISO/IEC 8859 , and Extended Unix Code , which is used for East Asian languages. More specialised applications of ISO 2022 include the MARC-8 encoding system used in MARC 21 library records. The escape sequences for switching to particular character sets or encodings are registered with the ISO-IR registry (except for those set apart for private use, the meanings of which are defined by vendors, or by protocol specifications such as ARIB STD-B24 ) and follow

2425-408: Is no intermediate byte. MARC 21 uses GS (0x1D) as a record terminator, RS (0x1E) as a field terminator and US (0x1F) as a subfield delimiter. The following alternative C1 control code set is defined for bibliographic applications such as library systems . It is mostly concerned with string collation, and with markup of bibliographic fields. Slightly different variants are defined in

2522-419: Is not stipulated by ISO/IEC 2022 / ECMA-35 itself, although it recommends allocating them sequentially starting with F byte 0x40 ( @ ); however, a manner for transmitting DRCS fonts is defined within some telecommunication protocols such as World System Teletext . There are also three special cases for multi-byte codes. The code sequences ESC $ @ , ESC $ A , and ESC $ B were all registered when

2619-511: Is required that any C0 character set include the ESC character at position 0x1B, so that further changes are possible. The control set designation sequences (as opposed to the graphical set ones) may also be used from within ISO/IEC 10646 (UCS/Unicode), in contexts where processing ANSI escape codes is appropriate, provided that each byte in the sequence is padded to the code unit size of the encoding. A table of escape sequence I bytes and

2716-600: Is the only multibyte encoding of MARC-8, it encodes each CJK character in three ASCII bytes. For example, to encode the U+4EBA CJK character (人) you will need the following bytes The \x1B\x24\x31 switches to EACC/CJK, and the \x21\x30\x64 corresponds to the U+4EBA. In addition to the ISO-2022 character sets, the following custom sets are available too. The byte designation follows the escape byte (hexadecimal 1B). There

2813-415: Is the use of '\n' when communicating using an Internet protocol that mandates the use of ASCII CR + LF for ending lines. Writing '\n' to a text mode stream works correctly on Windows systems, but produces only LF on Unix, and something completely different on more exotic systems. Using "\r\n" in binary mode is slightly better. Many languages, such as C++ , Perl , and Haskell provide

2910-604: The ASCII CR and LF control codes , also provides a "next line" ( NEL ) control code, as well as control codes for "line separator" and "paragraph separator" markers. Unicode also contains printable characters for visually representing line feed ␊, carriage return ␍, and other C0 control codes (as well as a generic newline, ␤) in the Control Pictures block. Many communications protocols have some sort of new line convention. In particular, protocols published by

3007-692: The English alphabet ), and does not provide good support for languages which use additional letters, or which use a different writing system altogether. Other writing systems with relatively few characters, such as Greek , Cyrillic , Arabic or Hebrew , as well as forms of the Latin script using diacritics or letters absent from the ISO Basic Latin alphabet, have historically been represented on personal computers with different 8- bit , single byte , extended ASCII encodings, which follow ASCII when

MARC-8 - Misplaced Pages Continue

3104-583: The ISO/IEC 2022 extension mechanism, the DIN 31626 set is designated as the active C1 control character set with the sequence 0x1B 0x22 0x45 ( ESC " E ), and the ISO 6630 / DIN ISO 6630 set is designated with the sequence 0x1B 0x22 0x42 ( ESC " B ). The 1985 expansion of the ISO 6630 set can also be explicitly specified by using the sequence 0x1B 0x26 0x40 0x1B 0x22 0x42 ( ESC & @ ESC " B ). ISO-2022 ISO/IEC 2022 Information technology—Character code structure and extension techniques ,

3201-627: The International Organization for Standardization (ISO) and the American Standards Association (ASA), the latter being the predecessor organization to American National Standards Institute (ANSI). During the period of 1963 to 1968, the ISO draft standards supported the use of either CR + LF or LF alone as a newline, while the ASA drafts supported only CR + LF . The sequence CR + LF

3298-549: The Internet Engineering Task Force (IETF) typically use the ASCII CRLF sequence. In some older protocols, the new line may be followed by a checksum or parity character. The Unicode standard defines a number of characters that conforming applications should recognize as line terminators: While it may seem overly complicated compared to an approach such as converting all line terminators to

3395-537: The VT100 , and are thus supported by terminal emulators . By default, GL codes specify G0 characters and GR codes (where available) specify G1 characters; this may be otherwise specified by prior agreement. The set invoked over each area may also be modified with control codes referred to as shifts, as shown in the table below. An 8-bit code may have GR codes specifying G1 characters, i.e. with its corresponding 7-bit code using Shift In and Shift Out to switch between

3492-616: The most significant bit is 0 (i.e. bytes 0x00–7F, when represented in hexadecimal ), and include additional characters for a most significant bit of 1 (i.e. bytes 0x80–FF). Some of these, such as the ISO 8859 series, conform to ISO 2022, while others such as DOS code page 437 do not, usually due to not reserving the bytes 0x80–9F for control codes. Certain East Asian languages, specifically Chinese , Japanese , and Korean (collectively " CJK "), are written using far more characters than

3589-495: The 0x20/A0 and 0x7F/FF bytes are actually assigned by the set; some examples of graphical character sets which are registered as 96-sets but do not use those bytes include the G1 set of I.S. 434 , the box drawing set from ISO/IEC 10367 , and ISO-IR-164 (a subset of the G1 set of ISO-8859-8 with only the letters, used by CCITT ). Characters are expected to be spacing characters, not combining characters, unless specified otherwise by

3686-576: The ASCII LF and CR control characters. The C standard only guarantees two traits: On Unix operating system platforms, where C originated, the native newline sequence is ASCII LF ( 0x0A ), so '\n' was simply defined to be that value. With the internal and external representation being identical, the translation performed in text mode is a no-op , and Unix has no notion of text mode or binary mode. This has caused many programmers who developed their software on Unix systems simply to ignore

3783-454: The C0 control codes (narrowly defined) are excluded, this can be expanded to 96 characters. Using two bytes, it is thus possible to represent up to 8,836 (94×94) characters; and, using three bytes, up to 830,584 (94×94×94) characters. Though the standard defines it, no registered character set uses three bytes (although EUC-TW 's unregistered G2 does, as does the similarly unregistered CCCII ). For

3880-589: The C0 set, besides the ten included by ISO 6429 / ECMA-48 (namely SOH, STX, ETX, EOT, ENQ, ACK, DLE, NAK, SYN and ETB), or inclusion of any of those ten in the C1 set, is also prohibited by the ISO/IEC 2022 / ECMA-35 standard. A C0 control set is invoked over the CL range 0x00 through 0x1F, whereas a C1 control function may be invoked over the CR range 0x80 through 0x9F (in an 8-bit environment) or by using escape sequences (in

3977-467: The CR range always either invokes the secondary (C1) controls or is unused. The delete character DEL (0x7F), the escape character ESC (0x1B) and the space character SP (0x20) are designated "fixed" coded characters and are always available when G0 is invoked over GL, irrespective of what character sets are designated. They may not be included in graphical character sets, although other sizes or types of whitespace character may be. Sequences using

MARC-8 - Misplaced Pages Continue

4074-448: The ESC (escape) character take the form ESC [ I ...] F , where the ESC character is followed by zero or more intermediate bytes ( I ) from the range 0x20–0x2F, and one final byte ( F ) from the range 0x30–0x7E. The first I byte, or absence thereof, determines the type of escape sequence; it might, for instance, designate a working set, or denote a single control function. In all types of escape sequences, F bytes in

4171-566: The ESC (escape) control character at 0x1B (a C0 set containing only ESC is registered as ISO-IR-104), whereas a C1 control set may not contain the escape control whatsoever. Hence, they are entirely separate registrations, with a C0 set being only a C0 set and a C1 set being only a C1 set. If codes from the C0 set of ISO 6429 / ECMA-48, i.e. the ASCII control codes , appear in the C0 set, they are required to appear at their ISO 6429 / ECMA-48 locations. Inclusion of transmission control characters in

4268-542: The ESC control character is followed by a byte from columns 04 or 05 (that is to say, ESC 0x40 (@) through ESC 0x5F (_) ). Additional control functions are assigned to "type Fs" escape sequences (in the range ESC 0x60 (`) through ESC 0x7E (~) ); these have permanently assigned meanings rather than depending on the C0 or C1 designations. Registration of control functions to type "Fs" sequences must be approved by ISO/IEC JTC 1/SC 2 . Other single control functions may be registered to type "3Ft" escape sequences (in

4365-724: The German standard DIN 31626 (published in 1978 and since withdrawn) and the ISO standard ISO 6630 , the latter of which has also been adopted in Germany as DIN ISO 6630 . Where these differ is noted in the table below where applicable. MARC-8 uses the coding of NSB and NSE from this set, and adds some additional format effectors in locations not used by the ISO version; however, MARC 21 uses this control set only in MARC-8 records, not in Unicode-format records. If using

4462-566: The ISO-IR registry is specified by ISO/IEC 2375 . Each registration receives a unique escape sequence, and a unique registry entry number to identify it. For example, the CCITT character set for Simplified Chinese is known as ISO-IR-165 . Registration of coded character sets with the ISO-IR registry identifies the documents specifying the character set or control function associated with an ISO/IEC 2022 non‑private-use escape sequence. This may be

4559-435: The ISO/IEC 2022 / ECMA-35 standard itself. They may be described elsewhere using hexadecimal , as is often used in this article, or using the corresponding ASCII characters, although the escape sequences are actually defined in terms of byte values, and the graphic assigned to that byte value may be altered without affecting the control sequence. Byte values from the 7-bit ASCII graphic range (hexadecimal 0x20–0x7F), being on

4656-564: The Japanese JIS X 0208 ) so as to use multiple in a single document, effectively combining them into a single stateful encoding (a feature less important since the advent of Unicode ). It is designed to be usable in both 8-bit environments and 7-bit environments (those where only seven bits are usable in a byte, such as e-mail without 8BITMIME ). The ASCII character set supports the ISO Basic Latin alphabet (equivalent to

4753-498: The MARC-8 Unicode conversion issues in more detail. Character NFD The ISO/IEC 2022 coding specifies a two-layer mapping between character codes and displayed characters. In MARC-8, character codes from the 7-bit ASCII graphic range (0x20–0x7F) are referred to as "G0" codes, while codes from the "high ASCII" range (0xA0–0xFF) are referred to as the "G1" codes. Graphic character sets are designated and invoked by means of

4850-460: The abstract logic of software can combine them together as one event. This is why a newline in character encoding can be defined as CR and LF combined into one (commonly called CR+LF or CRLF ). Some character sets provide a separate newline character code. EBCDIC , for example, provides an NL character code in addition to the CR and LF codes. Unicode , in addition to providing

4947-542: The basis that it leaves the graphical character repertoire undefined. ISO/IEC 4873 / ECMA-43 does, however, permit the use of the GCC function provided that the sequence of characters is kept the same and merely displayed in one space, rather than being over-stamped to form a character with a different meaning. Control character sets are classified as "primary" or "secondary" control code sets, respectively also called "C0" and "C1" control code sets. A C0 control set must contain

SECTION 50

#1732780871560

5044-462: The body". Differences between SMTP implementations in how they treat bare LF and/or bare CR characters have led to SMTP spoofing attacks referred to as "SMTP smuggling". The File Transfer Protocol can automatically convert newlines in files being transferred between systems with different newline representations when the transfer is done in "ASCII mode". However, transferring binary files in this mode usually has disastrous results: any occurrence of

5141-453: The concatenation of literal textual Morse codes "B" and "T" characters, sent without the normal inter-character spacing, is used in Morse code to encode and indicate a new line or new section in a formal text message. Later, in the age of modern teleprinters , standardized character set control codes were developed to aid in white space text formatting. ASCII was developed simultaneously by

5238-503: The concept of C0 and C1 control codes from ISO 2022, although it adds other non-printing characters besides the ISO 2022 control codes. However, Unicode transformation formats such as UTF-8 generally deviate from the ISO 2022 structure in various ways, including: ISO 2022 escape sequences do, however, exist for switching to and from UTF-8 as a " coding system different from that of ISO 2022 ", which are supported by certain terminal emulators such as xterm . ISO/IEC 2022 specifies

5335-513: The contemporary version of the standard allowed multi-byte sets only in G0, so must be accepted in place of the sequences ESC $ ( @ through ESC $ ( B to designate to the G0 character set. There are additional (rarely used) features for switching control character sets, but this is a single-level lookup, in that (as noted above) the C0 set is always invoked over CL, and the C1 set is always invoked over CR or by using escape codes. As noted above, it

5432-434: The designation or other function which they perform is below. Note that the registry of F bytes is independent for the different types. The 94-character graphic set designated by ESC ( A through ESC + A is not related in any way to the 96-character set designated by ESC - A through ESC / A . And neither of those is related to the 94 -character set designated by ESC $ ( A through ESC $ + A , and so on;

5529-399: The dictated standard, many applications erroneously use the C newline escape sequence '\n' ( LF ) instead of the correct combination of carriage return escape and newline escape sequences '\r\n' ( CR + LF ) (see section Newline in programming languages above). This accidental use of the wrong escape sequences leads to problems when trying to communicate with systems adhering to

5626-402: The different standards. Web browsers are usually also capable of displaying text files and websites which use different types of newlines. Even if a program supports different newline conventions, these features are often not sufficiently labeled, described, or documented. Typically a menu or combo-box enumerating different newline conventions will be displayed to users without an indication if

5723-500: The distinction completely, resulting in code that is not portable to different platforms. The C library function fgets () is best avoided in binary mode because any file not written with the Unix newline convention will be misread. Also, in text mode, any file not written with the system's native newline sequence (such as a file created on a Unix system, then copied to a Windows system) will be misread as well. Another common problem

5820-536: The editor Vim can make a file compatible with the Windows Notepad text editor. Within vim Editors can be unsuitable for converting larger files or bulk conversion of many files. For larger files (on Windows NT) the following command is often used: Special purpose programs to convert files between different newline conventions include unix2dos and dos2unix , mac2unix and unix2mac , mac2dos and dos2mac , and flip . The tr command

5917-456: The end it is up to users to make sure their files are transferred in the correct mode. If there is any doubt as to the correct mode, binary mode should be used, as then no files will be altered by FTP, though they may display incorrectly. Text editors are often used for converting a text file between different newline formats; most modern editors can read and write files using at least the different ASCII CR / LF conventions. For example,

SECTION 60

#1732780871560

6014-516: The escape sequences listed below, whereas the others are part of a C0 or C1 control code set (as shown below, SI (LS0) and SO (LS1) are C0 controls and SS2 and SS3 are C1 controls), meaning that their coding and availability may vary depending on which control sets are designated: they must be present in the designated control sets if their functionality is used. The C1 controls themselves, as mentioned above, may be represented using escape sequences or 8-bit bytes, but not both. Alternative encodings of

6111-436: The final bytes must be interpreted in context. (Indeed, without any intermediate bytes, ESC A is a way of specifying the C1 control code 0x81.) Newline A newline (frequently called line ending , end of line ( EOL ), next line ( NEL ) or line break ) is a control character or sequence of control characters in character encoding specifications such as ASCII , EBCDIC , Unicode , etc. This character, or

6208-683: The following: A specific implementation does not have to implement all of the standard; the conformance level and the supported character sets are defined by the implementation. Although many of the mechanisms defined by the ISO/IEC 2022 standard are infrequently used, several established encodings are based on a subset of the ISO/IEC 2022 system. In particular, 7-bit encoding systems using ISO/IEC 2022 mechanisms include ISO-2022-JP (or JIS encoding ), which has primarily been used in Japanese-language e-mail . 8-bit encoding systems conforming to ISO/IEC 2022 include ISO/IEC 4873 (ECMA-43), which

6305-490: The form ESC ( ! F have been assigned. At the other extreme, no multibyte 96-sets have been registered, so the sequences below are strictly theoretical. As with other escape sequence types, the range 0x30–0x3F is reserved for private-use F bytes, in this case for private-use character set definitions (which might include unregistered sets defined by protocols such as ARIB STD-B24 or MARC-8 , or vendor-specific sets such as DEC Special Graphics ). However, in

6402-492: The graphical set in question. ISO 2022 / ECMA-35 also recognizes the use of the backspace and carriage return control characters as means of combining otherwise spacing characters, as well as the CSI sequence "Graphic Character Combination" (GCC) ( CSI 0x20 (SP) 0x5F (_) ). Use of the backspace and carriage return in this manner is permitted by ISO/IEC 646 but prohibited by ISO/IEC 4873 / ECMA-43 and by ISO/IEC 8859 , on

6499-427: The last are expected to be terminated by a newline. If the final character sequence in a text file is not a newline, the final line of the file may be considered to be an improper or incomplete text line, or the file may be considered to be improperly truncated. In text intended primarily to be read by humans using software which implements the word wrap feature, a newline character typically only needs to be stored if

6596-419: The left side of a character code table, are referred to as "GL" codes (with "GL" standing for "graphics left") while bytes from the "high ASCII" range (0xA0–0xFF), if available (i.e. in an 8-bit environment), are referred to as the "GR" codes ("graphics right") . The terms "CL" (0x00–0x1F) and "CR" (0x80–0x9F) are defined for the control ranges, but the CL range always invokes the primary (C0) controls, whereas

6693-537: The maximum of 256 which can be represented in a single byte, and were first represented on computers with language-specific double-byte encodings or variable-width encodings ; some of these (such as the Simplified Chinese encoding GB 2312 ) conform to ISO 2022 , while others (such as the Traditional Chinese encoding Big5 ) do not. Control codes in ISO 2022 are always represented with

6790-453: The needs of Teletype machines. Most minicomputer systems from DEC used this convention. CP/M also used it in order to print on the same terminals that minicomputers used. From there MS-DOS (1981) adopted CP/M 's CR + LF in order to be compatible, and this convention was inherited by Microsoft's later Windows operating system. The Multics operating system began development in 1964 and used LF alone as its newline. Multics used

6887-401: The newline byte sequence—which does not have line terminator semantics in this context, but is just part of a normal sequence of bytes—will be translated to whatever newline representation the other system uses, effectively corrupting the file. FTP clients often employ some heuristics (for example, inspection of filename extensions ) to automatically select either binary or ASCII mode, but in

6984-594: The newline codes greater than 0x7F ( NEL , LS and PS ) is not often done. They are multiple bytes in UTF-8 , and the code for NEL has been used as the ellipsis ( … ) character in Windows-1252 . For instance: The Unicode special characters U+2424 ( SYMBOL FOR NEWLINE , ␤ ), U+23CE ( RETURN SYMBOL , ⏎ ), U+240D ( SYMBOL FOR CARRIAGE RETURN , ␍ ) and U+240A ( SYMBOL FOR LINE FEED , ␊ ) are glyphs intended for presenting

7081-440: The next character. Any character printed after a CR would often print as a smudge in the middle of the page while the print head was still moving the carriage back to the first position. "The solution was to make the newline two characters: CR to move the carriage to column one, and LF to move the paper up." In fact, it was often necessary to send extra padding characters —extraneous CRs or NULs—which are ignored but give

7178-436: The paper, or by moving a display cursor up one line) so that other characters may be printed over existing text. This may be done to make them bolder, or to add underlines, strike-throughs or other characters such as diacritics . Similarly, PLD ( U +008B PARTIAL LINE FORWARD, decimal 139) and PLU ( U +008C PARTIAL LINE BACKWARD, decimal 140) can be used to advance or reverse the text printing position by some fraction of

7275-408: The patterns defined within the standard. Character encodings making use of these escape sequences require data to be processed sequentially in a forward direction, since the correct interpretation of the data depends on previously encountered escape sequences. Specific profiles such as ISO-2022-JP may impose extra conditions, such as that the current character set is reset to US-ASCII before the end of

7372-523: The platform has a Perl interpreter: The file command can identify the type of line endings: The Unix egrep (extended grep) command can be used to print filenames of Unix or DOS files (assuming Unix and DOS-style files only, no classic Mac OS-style files): Other tools permit the user to visualise the EOL characters: Two ways to view newlines, both of which are self-consistent , are that newlines either separate lines or that they terminate lines. If

7469-463: The print head time to move to the left margin. Many early video displays also required multiple character times to scroll the display. On such systems, applications had to talk directly to the Teletype machine and follow its conventions since the concept of device drivers hiding such hardware details from the application was not yet well developed. Therefore, text was routinely composed to satisfy

7566-777: The range ESC 0x23 (#) [ I ...] 0x40 (@) through ESC 0x23 (#) [ I ...] 0x7E (~) ), although no "3Ft" sequences are currently assigned (as of 2019). Some of these are specified in ECMA-35 (ISO 2022 / ANSI X3.41), others in ECMA-48 (ISO 6429 / ANSI X3.64). ECMA-48 refers to these as "independent control functions". Escape sequences of type "Fp" ( ESC 0x30 (0) through ESC 0x3F (?) ) or of type "3Fp" ( ESC 0x23 (#) [ I ...] 0x30 (0) through ESC 0x23 (#) [ I ...] 0x3F (?) ) are reserved for single private use control codes, by prior agreement between parties. Several such sequences of both types are used by DEC terminals such as

7663-446: The range 0x20–0x2F, then by a single byte in the range 0x40–0x7E, the entire sequence being called a "control sequence". Each of the four working sets G0 through G3 may be a 94-character set or a 94 -character multi-byte set . Additionally, G1 through G3 may be a 96- or 96 -character set. In a 96- or 96 -character set, the bytes 0x20 through 0x7F when GL-invoked, or 0xA0 through 0xFF when GR-invoked, are allocated to and may be used by

7760-427: The range 0x30–0x3F are reserved for unregistered private uses defined by prior agreement between parties. Control functions from some sets may make use of further bytes following the escape sequence proper. For example, the ISO 6429 control function " Control Sequence Introducer ", which can be represented using an escape sequence, is followed by zero or more bytes in the range 0x30–0x3F, then zero or more bytes in

7857-572: The same interpretation of '\n' as C. C++ has an alternative input/output (I/O) model where the manipulator std::endl can be used to output a newline (and flushes the stream buffer). Java , PHP , and Python provide the '\r\n' sequence (for ASCII CR + LF ). In contrast to C, these are guaranteed to represent the values U+000D and U+000A , respectively. The Java input/output (I/O) libraries do not transparently translate these into platform-dependent newline sequences on input or output. Instead, they provide functions for writing

7954-669: The same pair of C0 control characters (0x0F and 0x0E) as the names "shift in" (SI) and "shift out" (SO). However, the standard refers to them as LS0 and LS1 when they are used in 8-bit environments and as SI and SO when they are used in 7-bit environments. The ISO/IEC 2022 / ECMA-35 standard permits, but discourages, invoking G1, G2 or G3 in both GL and GR simultaneously. The ISO International register of coded character sets to be used with escape sequences (ISO-IR) lists graphical character sets, control code sets, single control codes and so forth which have been registered for use with ISO/IEC 2022. The procedure for registering codes and sets with

8051-467: The selection will re-interpret, temporarily convert, or permanently convert the newlines. Some programs will implicitly convert on open, copy, paste, or save—often inconsistently. Most textual Internet protocols (including HTTP , SMTP , FTP , IRC , and many others) mandate the use of ASCII CR + LF ( '\r\n' , 0x0D 0x0A ) on the protocol level, but recommend that tolerant applications recognize lone LF ( '\n' , 0x0A ) as well. Despite

8148-440: The set is single-byte or multi-byte (although not how many bytes it uses if it is multi-byte), and also whether each byte has 94 or 96 permitted values. ISO/IEC 2022 coding specifies a two-layer mapping between character codes and displayed characters. Escape sequences allow any of a large registry of graphic character sets to be "designated" into one of four working sets, named G0 through G3, and shorter control sequences specify

8245-455: The set. In a 94- or 94 -character set, the bytes 0x20 and 0x7F are not used. When a 96- or 96 -character set is invoked in the GL region, the space and delete characters (codes 0x20 and 0x7F) are not available until a 94- or 94 -character set (such as the G0 set) is invoked in GL. 96-character sets cannot be designated to G0. Registration of a set as a 96-character set does not necessarily mean that

8342-424: The sets (e.g. JIS X 0201 ), although some instead have GR codes specifying G2 characters, with the corresponding 7-bit code using a single-shift code to access the second set (e.g. T.51 ). The codes shown in the table below are the most common encodings of these control codes, conforming to ISO/IEC 6429 . The LS2, LS3, LS1R, LS2R and LS3R shifts are registered as single control functions and are always encoded as

8439-403: The single-shift area. This must be specified in the definition of the code version. For instance, ISO/IEC 4873 specifies GL, whereas packed EUC specifies GR. In 7-bit environments, only GL is used as the single-shift area. If necessary, which single-shift area is used may be communicated using announcer sequences . The names "locking shift zero" (LS0) and "locking shift one" (LS1) refer to

8536-468: The single-shifts as C0 control codes are available in certain control code sets. For example, SS2 and SS3 are usually available at 0x19 and 0x1D respectively in T.51 and T.61 . This coding is currently recommended by ISO/IEC 2022 / ECMA-35 for applications requiring 7-bit single-byte representations of SS2 and SS3, and may also be used for SS2 only, although older code sets with SS2 at 0x1C also exist, and were mentioned as such in an earlier edition of

8633-521: The standard. The 0x8E and 0x8F coding of the single shifts as shown below is mandatory for ISO/IEC 4873 levels 2 and 3. Although officially considered shift codes and named accordingly, single-shift codes are not always viewed as shifts, and they may simply be viewed as prefix bytes (i.e. the first bytes in a multi-byte sequence), since they do not require the encoder to keep the currently active set as state , unlike locking shift codes. In 8-bit environments, either GL or GR, but not both, may be used as

8730-415: The stricter interpretation of the standards instead of the suggested tolerant interpretation. One such intolerant system is the qmail mail transfer agent that actively refuses to accept messages from systems that send bare LF instead of the required CR + LF . The standard Internet Message Format for email states: "CR and LF MUST only occur together as CRLF; they MUST NOT appear independently in

8827-542: The string ISO 646-1983//CHARSET International Reference Version (IRV)//ESC 2/5 4/0 can be used to identify the International Reference Version of ISO 646 -1983, and the HTML 4.01 specification uses ISO Registration Number 177//CHARSET ISO/IEC 10646-1:1993 UCS-4 with implementation level 3//ESC 2/5 2/15 4/6 to identify Unicode. The textual representation of the escape sequence, included in

8924-458: The third element of the FPI, will be recognised by SGML implementations for supported character sets. Escape sequences to designate character sets take the form ESC I [ I ...] F . As mentioned above, the intermediate ( I ) bytes are from the range 0x20–0x2F, and the final ( F ) byte is from the range 0x30–0x7E. The first I byte (or, for a multi-byte set, the first two) identifies

9021-424: The two-byte character sets, the code point of each character is normally specified in so-called row-cell or kuten form, which comprises two numbers between 1 and 94 inclusive, specifying a row and cell of that character within the zone. For a three-byte set, an additional plane number is included at the beginning. The escape sequences do not only declare which character set is being used, but also whether

9118-423: The type of character set and the working set it is to be designated to, whereas the F byte (and any additional I bytes) identify the character set itself, as assigned in the ISO-IR register (or, for the private-use escape sequences, by prior agreement). Additional I bytes may be added before the F byte to extend the F byte range. This is currently only used with 94-character sets, where codes of

9215-473: The use of LF alone as a line terminator had already been incorporated into drafts of the eventual ISO/IEC 646 standard. Unix followed the Multics practice, and later Unix-like systems followed Unix. This created conflicts between Windows and Unix-like operating systems , whereby files composed on one operating system could not be properly formatted or interpreted by another operating system (for example

9312-410: The working set that is "invoked" to interpret bytes in the stream. Encoding byte values ("bit combinations") are often given in column-line notation , where two decimal numbers in the range 00–15 (each corresponding to a single hexadecimal digit) are separated by a slash. Hence, for instance, codes 2/0 (0x20) through 2/15 (0x2F) inclusive may be referred to as "column 02". This is the notation used in

9409-403: Was commonly used on many early computer systems that had adopted Teletype machines—typically a Teletype Model 33 ASR—as a console device, because this sequence was required to position those printers at the start of a new line. The separation of newline into two functions concealed the fact that the print head could not return from the far right to the beginning of the next line in time to print

#559440