What is the NEL line terminator?

107 Views Asked by At

I know CR, LF, and CRLF, but I have never encountered NEL. I encountered this line terminator for the first time today. No particularly detailed descriptive documents were found. Will it cause some request resources to be garbled? The JavaScript file I obtained from the Android client is garbled.

Manually change it to LF.

1

There are 1 best solutions below

0
On

The NEL (Next Line) line terminator is a Unicode character with the code 0x85 in hexadecimal, or 133 in decimal. For more information, see Compart.

In the EBCDIC (Extended Binary Coded Decimal Interchange Code) encoding system, which was primarily used in IBM mainframes in the 1960s, NL (0x15 in EBCDIC) is mapped to NEL (0x85 in Unicode). This is explained on Wikipedia's newline page:

For example: NL is part of EBCDIC, which uses code 0x15; it is normally mapped to Unicode NEL, 0x85, which 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 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:

  • ECMAScript accepts LS and PS as line breaks, but considers U+0085 (NEL) whitespace instead of a line break.
  • JSON allows LS and PS characters within strings, while ECMAScript prior to ES2019 treated them as newlines, and therefore illegal syntax.
  • YAML no longer recognizes them as line breaks as of version 1.2, in order to be compatible with JSON.
  • Windows Notepad, the default text editor of Microsoft Windows, does not treat any of NEL, LS, or PS as line breaks.
  • gedit, the default text editor of the GNOME desktop environment, treats LS and PS, but not NEL, as line breaks.

Therefore, NEL may not be processed correctly in some programs.

Other Wikipedia pages also discuss NEL. For example, EBCDIC explains:

The most common newline convention used with EBCDIC is to use a NEL (NEXT LINE) code between lines. Converters to other encodings often replace NEL with LF or CR/LF, even if there is a NEL in the target encoding. This causes the LF and NEL to translate to the same character and be unable to be distinguished.

The mapping of NL in EBCDIC to NEL in Unicode is detailed in the EBCDIC section on NL:

NL (EBCDIC 15) (Unicode paring 0085) New Line: Line break. Default mapping (0085) matches ISO/IEC 6429's NEL. Mappings sometimes swapped with Line Feed (EBCDIC 0x25) in accordance with UNIX line breaking convention.[10]

And C0 and C1 control codes further clarifies that NEL is:

Equivalent to CR+LF. Used to mark end-of-line on some IBM mainframes.

So, yes, using the NEL line terminator (Unicode character 0x85) can potentially cause some resources to become garbled in certain contexts. This is because NEL is not properly processed by all software or programming languages.