HtmlDecode plugin for Take Command / TCC / TCC/LE
Version 1.0.2.3 2025-01-27
Charles Dye
Purpose:
This plugin reimplements the @HTMLDECODE
and @HTMLENCODE
functions. It supports all
HTML 4 character entities, and adds a few new features including support for
high-order Unicode characters.
Installation:
To use this plugin, copy HtmlDecode.dll to some
known location on your hard drive. (If you are still using the 32-bit version of
Take Command, take HtmlDecode-x86.dll instead of
HtmlDecode.dll.) Load the .DLL file with a
PLUGIN /L
command, for example:
plugin /l c:\bin\tcmd\test\htmldecode.dll
If you copy the .DLL file to a subdirectory named PlugIns within your Take Command program directory, it will be loaded automatically when TCC starts.
Plugin Features:
New functions: @HTMLDECODE
,
@HTMLENCODE
Syntax Note:
The syntax definitions in the following text use these conventions for clarity:
BOLD CODE | indicates text which must be typed exactly as shown. |
CODE | indicates optional text, which may be typed as shown or omitted. |
Bold italic | names a required argument; a value must be supplied. |
Regular italic | names an optional argument. |
ellipsis… | after an argument means that more than one may be given. |
Examples are shown in a gray box:
rem This is an example:
echo "%@htmlencode[%@char[0xa9]]"
Some command options take an argument. These are shown with a colon between the
option and its argument: /A:
arg
If you like, you may substitute an equals sign for the colon: /A=
arg
This is handy if the arg is a filename, and you want to use tab completion to
enter the filename.
Or you can omit the colon: /A
arg
New Functions:
@HTMLDECODE
— Replaces
HTML character entities in a string.
Syntax:
%@HTMLDECODE[
string]
@HTMLDECODE
recognizes all HTML 4 character entities, including
&#nnn; and &#xnnnn;
numeric entities. High-order Unicode characters are supported; for example,
a cat emoji:
echo %@htmldecode[😸]
Numeric entities in the range U+0080 through U+009F (C1 control codes) will be remapped to characters from code page 1252.
Note that the returned string may contain ampersands, pipes, or redirection
operators. You can deal with this by quoting the return value, or through
liberal use of SETDOS /X
to disable features.
@HTMLENCODE
— Replaces
characters in a string with HTML character entities.
Syntax:
%@HTMLENCODE[
string]
At present, the only characters replaced are:
Character: | Entity: | ||
---|---|---|---|
0x22 | " | double quotes | " |
0x26 | & | ampersand | & |
0x3C | < | less than | < |
0x3E | > | greater than | > |
0xA0 | non-breaking space | | |
control characters | &#nn; | ||
characters above U+FFFF | &#xnnnnn; |
Any characters in the range of %@CHAR[128]
through
%@CHAR[159]
will be remapped to characters from
code page 1252.
Note that the returned string is very likely to contain ampersands. You
can deal with this by quoting the return value, or by using SETDOS
to change or disable the command separator character.
Startup Message:
This plugin displays an informational line when it initializes. The
message will be suppressed in transient or pipe shells. You can disable it
for all shells by defining an environment variable named NOLOADMSG
,
for example:
set /e /u noloadmsg=1
Changes:
Version: | Date: | Changes: |
---|---|---|
1.0.2.3 | 2024-11-06 | Buffers can hold up to 16,383 characters. |
1.0.2.2 | 2024-10-03 | Changed http:// to https:// in the PLUGININFO block. |
1.0.2.1 | 2023-10-12 | Updated the plugin’s web address. |
1.0.2 | 2023-07-28 | @HTMLENCODE no longer
enitizes the vertical bar character. (No need, and | isn’t a valid HTML 4 entity anyway.) |
1.0.1 | 2022-06-17 | — |
Status and Licensing:
This plugin is © Copyright 2025, Charles Dye. Unaltered copies of the binary and documentation files may be freely distributed without restriction. I make no guarantee and give no warranty for its operation. If you find a problem, you can report it in the JP Software support forum.
Download:
You can download the current version of the plugin from https://charlesdye.net/dl/htmldecode.zip.