Top Prev Next Up Down

Chesslist

Utility for listing an UTF-8 file as a file dump where every line has a fixed amount of (unicode) characters and every character is of equal size. Control characters, undefined characters or illegal characters are replaced with a chess symbol.
♔   WHITE KING (null) '00'
♕   WHITE QUEEN (backspace) '08'x
♖   WHITE ROOK (form feed) '0C'x
♗   WHITE BISHOP (line feed) '0A'x
♘   WHITE KNIGHT (horizontal tabulation) '09'x
♙   WHITE PAWN (carriage return) '0D'x
♟   BLACK PAWN (next line) '85'x
♚   BLACK KING (control) Unicode general category Cc
♛   BLACK QUEEN (format) Unicode general category Cf
♜   BLACK ROOK (surrogate) Unicode general category Cs
♝   BLACK BISHOP (not assigned) Unicode general category Cn
♞  BLACK KNIGHT (illegal byte)
�  Unicode replacement character

Running export LD_LIBRARY_PATH=lib;bin/chesslist -r bin/chesslist in TEST directory.

Output on console


input bin/chesslist
output chess.lst
lines 1893
null 34078 ♔
backspace 273 ♕
form_feed 91 ♖
line_feed 40 ♗
horizontal_tabulation 78 ♘
carriage_return 81 ♙
next_line 0 ♟
Cc control 40976 ♚
Cf format 0 ♛
Cs surrogate 0 ♜
Cn not_assigned 3 ♝
Replaced  0 �
** WARNING, not an UTF-8 file** 22056 ♞



and the beginning of file chess.lst (20 first of 1893 lines). -blk 50, defaulted, but here line length seems to vary because of variable length font characters.

♚ELF♚♚♚♔♔♔♔♔♔♔♔♔♚♔>♔♚♔♔♔ Y♔♔♔♔♔♔@♔♔♔♔♔♔♔♞♞♚♔♔♔♔♔♔♔
♔♔@♔8♔♙♔@♔♚♔♚♔♚♔♔♔♚♔♔♔@♔♔♔♔♔♔♔@♔♔♔♔♔♔♔@♔♔♔♔♔♔♔♞♔♔♔
♔♔♔♞♔♔♔♔♔♔♕♔♔♔♔♔♔♔♚♔♔♔♚♔♔♔♚♚♔♔♔♔♔♔♚♚♔♔♔♔♔♔♚♚♔♔♔♔♔♔
♚♔♔♔♔♔♔♔♚♔♔♔♔♔♔♔♚♔♔♔♔♔♔♔♚♔♔♔♚♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔
♔♔♔♔♔♔♞O♔♔♔♔♔♔♞O♔♔♔♔♔♔♔♚♔♔♔♔♔♔♚♔♔♔♚♔♔♔♔P♔♔♔♔♔♔♔P♔♔
♔♔♔♔♔P♔♔♔♔♔♔q♞♔♔♔♔♔♔q♞♔♔♔♔♔♔♔♚♔♔♔♔♔♔♚♔♔♔♚♔♔♔♔♞♔♔♔♔
♔♔♞♔♔♔♔♔♔♞♔♔♔♔♔♞♔♔♔♔♔♔♞♔♔♔♔♔♔♔♚♔♔♔♔♔♔♚♔♔♔♚♔♔♔♕♘♚♔♔
♔♔♔♕♚♚♔♔♔♔♔♕♚♚♔♔♔♔♔ ♚♔♔♔♔♔♔♞4♔♔♔♔♔♔♔♚♔♔♔♔♔♔♚♔♔♔♚♔♔
♔♚♘♚♔♔♔♔♔♚♚♚♔♔♔♔♔♚♚♚♔♔♔♔♔0♚♔♔♔♔♔♔0♚♔♔♔♔♔♔♕♔♔♔♔♔♔♔♚
♔♔♔♚♔♔♔8♚♔♔♔♔♔♔8♚♔♔♔♔♔♔8♚♔♔♔♔♔♔ ♔♔♔♔♔♔♔ ♔♔♔♔♔♔♔♕♔♔
♔♔♔♔♔♚♔♔♔♚♔♔♔X♚♔♔♔♔♔♔X♚♔♔♔♔♔♔X♚♔♔♔♔♔♔D♔♔♔♔♔♔♔D♔♔♔♔
♔♔♔♚♔♔♔♔♔♔♔S♞d♚♔♔♔8♚♔♔♔♔♔♔8♚♔♔♔♔♔♔8♚♔♔♔♔♔♔ ♔♔♔♔♔♔♔
 ♔♔♔♔♔♔♔♕♔♔♔♔♔♔♔P♞d♚♔♔♔♞♔♔♔♔♔♔♞♔♔♔♔♔♔♞♔♔♔♔♔♔L♚♔♔♔♔
♔♔L♚♔♔♔♔♔♔♚♔♔♔♔♔♔♔Q♞d♚♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔
♔♔♔♔♔♔♔♔♔♔♔♔♔♔♔♚♔♔♔♔♔♔♔R♞d♚♔♔♔♕♘♚♔♔♔♔♔♕♚♚♔♔♔♔♔♕♚♚♔
♔♔♔♔♞♚♔♔♔♔♔♔♞♚♔♔♔♔♔♔♚♔♔♔♔♔♔♔/lib64/ld-linux-x86-64
.so.2♔♔♔♔♔♚♔♔♔♚♔♔♔♚♔♔♔GNU♔♚♞♔♞♚♔♔♔♚♔♔♔♔♔♔♔♚♔♔♔♚♔♔♔
♚♔♔♔GNU♔߇♞q♞Ԡ♚♞+♞♞Ѐ♞♞♞♚♔♔♔♚♔♔♔♚♔♔♔GNU♔♔♔♔♔♚♔♔♔♚♔♔♔
♔♔♔♔♔♔♔♔C♔♔♔♞♔♔♔♕♔♔♔♘♔♔♔ ♞♙c♚♔($@♚♚♔@I@ ♞♞♚♔♚♞p♞♚♞
♕♚♞♞♔P♞♕)♞T@H♚♚♞♞♚I♔♞♞da♞♘♞L2¡♞♗@♞♔♔♔♔♔♔♔♔♔♞♔♔♔♞♔♔

By only giving the utlity name as a command (export LD_LIBRARY_PATH=lib;bin/chesslist) we get

List any file to an editor friendly list file.
All control characters are replaced by CHESS symbols.
Line length is fixed to the value of -blk parameter (default 50),
'line length' is the number of UTF-8 characters on a single line.
All non-UTF8 characters are replaced by BLACK KNIGHT symbol.
♔   ♕   ♖   ♗   ♘   ♙   ♟   ♚   ♛   ♜   ♝   ♞
Syntax:
  Chesslist {<option>}* <input_file> {<output_file>}
if no <output_file> then name of <output_file> is chess.lst
Options:
  -blk:<line length> -- length of line in output
  -r -- replace characters with a code value over 16#FFFF#

on the console.
About the options
Source code of Chesslist