Scroll to navigation

DETOX.TBL(5) File Formats Manual DETOX.TBL(5)

NAME

detox.tbltranslation table for detox(1)

OVERVIEW

detox allows for configuration of how the safe, ISO 8859-1, and UTF-8 (Unicode) filters operate. Through text-based translation tables, it is possible to tune how these character sets are interpreted.

SYNTAX

The format of the translation tables is simple. There are two levels: one containing meta data and one containing the actual translations.

_
Default specifies the default translation for a character. An empty or non-existent default indicates that any unknown character should fall through to the next filter. In this manner, it is possible to chain together multiple translation tables in a sequence.
Indicates the start of a value list within the translation table.
lang
Indicates the start of a language specific value list within the translation table.
Indicates the end of a value list within the translation table.
value translation
Value can be specified in decimal (1), hex (0x01) or octal (01). The same rules that apply to sscanf apply here.

Translation can be a string or a quoted string, with either single or double quotes.

EXAMPLES

The following example shows a portion of a safe table, with only a few character replacements specified.

#
# This is a simple example of a "safe" table.  It only translates 4 characters.
#
# The default is commented out, so any character that is not in this table will
# be ignored.
#

# default   _

#
# This is the main replacement block.  Each line specifies a character and a
# string to replace it with.
#

start
0x09	_tab_		# comments work on lines, too
0x24	_dollar_	# $$$
0x26	_and_		# ampersand
end

#
# Starts an optional, language-specific translation block.  detox will read
# your locale and load the block if the word after start matches the language
# portion of your locale.
#
# In the example here, the character $ will be replaced with "_money_" if the
# user is working in English.  If the user is using a different language, $
# will be replaced with the value configured in the previous block, "_dollar_".
#

start en
0x24	_money_		# money money
end

# EOF

You could then enable this table in your ~/.detoxrc, in conjunction with other filters.

# Sample detoxrc

sequence default {
	safe {
		filename "/home/MYUSERNAME/.local/share/detox/safe.tbl";
	};
	safe;
	wipeup;
};

# EOF

When detox is run, it will run the custom safe filter first, then run the default safe filter, and the finally the wipeup filter. See detoxrc(5) for more details on the various filter types.

SEE ALSO

detox(1), detoxrc(5), ascii(7), iso_8859-1(7), unicode(7), utf-8(7)

AUTHORS

detox was written by Doug Harple.

February 24, 2021 Debian