Skip to content

Encodings & Line Endings

To show text, Vaste must know how the file’s bytes map to characters: the file’s encoding. Vaste detects the encoding when it opens a file and shows it in the status bar. If the text looks wrong, for example accented letters appear as two odd characters or as �, reopen the file with the right encoding.

Vaste checks these in order and uses the first that applies:

  1. A byte order mark at the start of the file selects UTF-8, UTF-16LE, or UTF-16BE.
  2. UTF-8, if the start of the file is valid UTF-8. A UTF-16 file without a byte order mark also opens as UTF-8. See UTF-16 files.
  3. A guess from the content of the file, for files that are not valid UTF-8, such as a file in windows-1252 or Shift_JIS.

Vaste detects the encoding from the start of the file only. A file that starts with plain English text but has accented letters further on opens as UTF-8, and those letters show as �. For such a file, choose the encoding yourself. For the exact rules, see Encodings on the Supported formats page.

The status bar shows the encoding’s name. A byte order mark adds it in parentheses, for example UTF-16LE (UTF-16 LE). A guess adds (detected), and hovering over the encoding shows Encoding guessed from the file content. Click to change.

Bytes that are not valid in the encoding appear as the replacement character �. Vaste does not show the byte order mark itself.

  1. In the status bar, select the encoding.

  2. In the list that opens, type part of a name in Search encodings… to filter it, for example 1251 or cyrillic.

  3. Select the encoding.

Vaste reopens the file with that encoding and rebuilds its line index. Reopening clears the search results, Grep view, combined searches, table filters and sorts, and data quality results. Vaste marks pinned results as stale. See Pinned results.

Vaste remembers the encoding you chose for that file and uses it every time you open the file again. The status bar drops (detected). Vaste does not detect the encoding of that file again, and you cannot return to automatic detection. To change it, choose another encoding from the list.

The status bar is the only place to change the encoding. There is no shortcut or menu command for it.

The list offers these encodings:

Group Encodings
Unicode UTF-8, UTF-16LE, UTF-16BE
Windows code pages windows-1250 to windows-1258, windows-874
ISO 8859 ISO-8859-2 to ISO-8859-8, ISO-8859-10, ISO-8859-13 to ISO-8859-16
Cyrillic KOI8-R, KOI8-U, IBM866, x-mac-cyrillic
Mac macintosh (Western)
Chinese GBK, gb18030, Big5
Japanese EUC-JP, ISO-2022-JP, Shift_JIS
Korean EUC-KR
Other x-user-defined

For a Latin-1 (ISO-8859-1) file, choose windows-1252, which includes all Latin-1 characters.

In files encoded as GBK, gb18030, Big5, EUC-JP, ISO-2022-JP, Shift_JIS, EUC-KR, or windows-874, search matches are listed but not highlighted in the line. Regular expressions with non-ASCII characters do not match in files that are not UTF-8. See Search modes.

Text in UTF-16 contains NUL bytes, and Vaste treats a file with NUL bytes and an unrecognized extension as binary. How a UTF-16 file opens depends on its extension and its byte order mark:

File Opens in
Known text extension, such as .txt or .log, with a byte order mark Text view, as UTF-16
Known text extension, without a byte order mark Text view, as UTF-8: the text appears with gaps or garbled
Any other extension Hex view, with or without a byte order mark

To read a UTF-16 file that opened in Hex view or as garbled text, switch to Text view with the view switcher, then change the encoding to UTF-16LE (the usual choice on Windows) or UTF-16BE. Vaste remembers the encoding, but the file still opens in Hex view next time if its extension is not a known text extension.

Regular expression search does not work in UTF-16 files. Use literal search. See Search modes.

The status bar shows the file’s line endings:

Status bar Meaning
LF Lines end with a newline, as on Linux and macOS
CRLF Lines end with a carriage return and a newline, as on Windows
Mixed The file has both kinds

Hover over the item to see how many lines end each way, for example 12 LF and 980 CRLF line endings. Vaste counts the whole file. While it builds the line index, the item shows a first guess from the start of the file. A file with no line breaks shows LF.

Vaste hides the carriage return at the end of a CRLF line, and copies lines with newlines only. A carriage return on its own does not end a line, so a file that uses only carriage returns, as in files from classic Mac OS, shows as one line.

Vaste does not change line endings. To match the end of a CRLF line with a regular expression, see Search modes.