Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2026-10-06 6bac54b555d27f1a85c1e4f011a6e7bd9111b0d0
src/test/regress/expected/htp.out
@@ -1,1068 +1,271 @@
select htp_enable_test_mode(1);
NOTICE:  HTML:
test mode on
 htp_enable_test_mode
----------------------
(1 row)
select htp_appletopen('my_app=let.class&я', 100, 200, 'f');
DO $$
BEGIN
    perform htp_appletopen('my_app=let.class&я', 100, 200, 'f');
    perform htp_appletclose();
    perform htp_blockquoteopen('1', '2', '3');
    perform htp_blockquoteclose();
    perform htp_blockquoteopen('s', '12.,3_-_321 Россия!', 'id="my_quote" !@#$%^&*( .');
    perform htp_blockquoteclose();
    perform htp_bodyopen('/images/background.gif.Стиль', 'Вася BGPROPERTIES="fixed"');
    perform htp_bodyclose();
    perform htp_dlistopen('hjv', 'class="my-definition-list"');
    perform htp_dlistclose();
    perform htp_formopen('/cgi-bin/&search.pl', 'G/ET-я', 'Яr/esults_frame', 'Яr/e', 'name="search_form" class="search-form"');
    perform htp_formclose();
    perform htp_fontopen('BL/UE', 'Verd/ana', '3/4', 'name="search_form" class="search-form"');
    perform htp_fontclose();
    perform htp_formselectopen('"hobby_list', 'Ва"ши хобби: ', 8.7, 'multiple style="width: 200px;"');
    perform htp_formselectclose();
    perform htp_framesetopen('', '25%, 75%', 'border="1"');
    perform htp_framesetclose();
    perform htp_mapopen(NULL, NULL);
    perform htp_mapclose();
    perform htp_olistopen('both"', 'soft"', NULL);
    perform htp_olistclose();
    perform htp_preopen('both"', '80"', 'class="source-code" style="font-size:12px;"');
    perform htp_preclose();
    perform htp_tableopen(' ', ' ', ' ', ' ', ' ');
    perform htp_tableclose();
    perform htp_tablerowopen('CENTER"', 'MIDDLE"', '1"', 'yes"', 'style="background-color: #E0E0E0;"');
    perform htp_tablerowclose();
    perform htp_ulistopen('a"', 'HORIZ"', '⚡', 'd"', 'class="energy-list" id="main"');
    perform htp_ulistclose();
    perform htp_centeropen();
    perform htp_centerclose();
    perform htp_dirlistopen();
    perform htp_dirlistclose();
    perform htp_headopen();
    perform htp_headclose();
    perform htp_htmlopen();
    perform htp_htmlclose();
    perform htp_listingopen();
    perform htp_listingclose();
    perform htp_menulistopen();
    perform htp_menulistclose();
    perform htp_noframesopen();
    perform htp_noframesclose();
    perform htp_escape_sc('Россия qwerasdf1234" & . @ '' ');
    perform htp_escape_sc('Visit <our site> & enjoy! !@#$%^&*()_+|/');
    perform htp_formcheckbox('"interests', '"travel', '9', 'style="color: blue;"');
    perform htp_formfile('"interests', '"travel', 'style="color: blue;"');
    perform htp_formhidden('"i', '"t', 'style="c"');
    perform htp_formimage('"i', '"t', '"','style="c"');
    perform htp_formpassword('"i', '"t', '"','"w"', 'style="c"');
    perform htp_formradio('"i', '"t', '"', 'style="c"');
    perform htp_formreset('"i', 'style="c"');
    perform htp_formselectoption('"i', '"','style="c"');
    perform htp_formsubmit('"i', '"','style="c"');
    perform htp_formtext('"i', '"','"9"', '"2"', 'style="c"');
    perform htp_formtextarea('"i', 2, 9, '"2"', 'style="c"');
    perform htp_formtextarea2('"i', 2.9, 9, '"2"', ' ', 'style="c"');
    perform htp_address(NULL, '', 'Б"al l*', 'style="font-style: italic;"');
    perform htp_anchor(NULL, 'NEW* сайт', 'x"в', 'class="external"');
    perform htp_area('x"в','x"в','x"в','x"в','x"в', 'b"Я');
    perform htp_get_data();
END $$;
NOTICE:  HTML: 
<applet code=my_app=let.class&amp;я width=100 height=200 f>
 htp_appletopen
----------------
(1 row)
select htp_appletclose();
NOTICE:  HTML:
</applet>
 htp_appletclose
-----------------
(1 row)
select htp_blockquoteopen('1', '2', '3');
NOTICE:  HTML:
<blockquote clear="2" nowrap="nowrap" 3>
 htp_blockquoteopen
--------------------
(1 row)
select htp_blockquoteclose();
NOTICE:  HTML:
</blockquote>
 htp_blockquoteclose
---------------------
(1 row)
select htp_blockquoteopen('s', '12.,3_-_321 Россия!', 'id="my_quote" !@#$%^&*( .');
NOTICE:  HTML:
<blockquote clear="12.,3_-_321&#x20;&#x0420;&#x043E;&#x0441;&#x0441;&#x0438;&#x044F;&#x21;" nowrap="nowrap" id="my_quote" !@#$%^&*( .>
 htp_blockquoteopen
--------------------
(1 row)
select htp_blockquoteclose();
NOTICE:  HTML:
</blockquote>
 htp_blockquoteclose
---------------------
(1 row)
select htp_bodyopen('/images/background.gif.Стиль', 'Вася BGPROPERTIES="fixed"');
NOTICE:  HTML:
<body background="&#x2F;images&#x2F;background.gif.&#x0421;&#x0442;&#x0438;&#x043B;&#x044C;" Вася BGPROPERTIES="fixed">
 htp_bodyopen
--------------
(1 row)
select htp_bodyclose();
NOTICE:  HTML:
</body>
 htp_bodyclose
---------------
(1 row)
select htp_dlistopen('hjv', 'class="my-definition-list"');
NOTICE:  HTML:
<dl clear="hjv" class="my-definition-list">
 htp_dlistopen
---------------
(1 row)
select htp_dlistclose();
NOTICE:  HTML:
</dl>
 htp_dlistclose
----------------
(1 row)
select htp_formopen('/cgi-bin/&search.pl', 'G/ET-я', 'Яr/esults_frame', 'Яr/e', 'name="search_form" class="search-form"');
NOTICE:  HTML:
<form action="/cgi-bin/&amp;search.pl" method="G&#x2F;ET-&#x044F;" target="&#x042F;r&#x2F;esults_frame" enctype="&#x042F;r&#x2F;e" name="search_form" class="search-form">
 htp_formopen
--------------
(1 row)
select htp_formclose();
NOTICE:  HTML:
</form>
 htp_formclose
---------------
(1 row)
select htp_fontopen('BL/UE', 'Verd/ana', '3/4', 'name="search_form" class="search-form"');
NOTICE:  HTML:
<font color="BL&#x2F;UE" face="Verd&#x2F;ana" size="3&#x2F;4" name="search_form" class="search-form">
 htp_fontopen
--------------
(1 row)
select htp_fontclose();
NOTICE:  HTML:
</font>
 htp_fontclose
---------------
(1 row)
select htp_formselectopen('"hobby_list', 'Ва"ши хобби: ', 8.7, 'multiple style="width: 200px;"');
NOTICE:  HTML:
 Ва"ши хобби: <select name="&#x22;hobby_list" size="8.7" multiple style="width: 200px;">
 htp_formselectopen
--------------------
(1 row)
select htp_formselectclose();
NOTICE:  HTML:
</select>
 htp_formselectclose
---------------------
(1 row)
select htp_framesetopen('', '25%, 75%', 'border="1"');
NOTICE:  HTML:
<frameset cols="25&#x25;,&#x20;75&#x25;" border="1">
 htp_framesetopen
------------------
(1 row)
select htp_framesetclose();
NOTICE:  HTML:
</frameset>
 htp_framesetclose
-------------------
(1 row)
select htp_mapopen(NULL, NULL);
NOTICE:  HTML:
<map name="">
 htp_mapopen
-------------
(1 row)
select htp_mapclose();
NOTICE:  HTML:
</map>
 htp_mapclose
--------------
(1 row)
select htp_olistopen('both"', 'soft"', NULL);
NOTICE:  HTML:
<ol clear="both&#x22;" wrap="soft&#x22;">
 htp_olistopen
---------------
(1 row)
select htp_olistclose();
NOTICE:  HTML:
</ol>
 htp_olistclose
----------------
(1 row)
select htp_preopen('both"', '80"', 'class="source-code" style="font-size:12px;"');
NOTICE:  HTML:
<pre clear="both&#x22;" width="80&#x22;" class="source-code" style="font-size:12px;">
 htp_preopen
-------------
(1 row)
select htp_preclose();
NOTICE:  HTML:
</pre>
 htp_preclose
--------------
(1 row)
select htp_tableopen(' ', ' ', ' ', ' ', ' ');
NOTICE:  HTML:
<table  &#x20; nowrap="nowrap" align="&#x20;" clear="&#x20;"  >
 htp_tableopen
---------------
(1 row)
select htp_tableclose();
NOTICE:  HTML:
</table>
 htp_tableclose
----------------
(1 row)
select htp_tablerowopen('CENTER"', 'MIDDLE"', '1"', 'yes"', 'style="background-color: #E0E0E0;"');
NOTICE:  HTML:
<tr align="CENTER&#x22;" valign="MIDDLE&#x22;" dp="1&#x22;" nowrap="nowrap" style="background-color: #E0E0E0;">
 htp_tablerowopen
------------------
(1 row)
select htp_tablerowclose();
NOTICE:  HTML:
</tr>
 htp_tablerowclose
-------------------
(1 row)
select htp_ulistopen('a"', 'HORIZ"', '⚡', 'd"', 'class="energy-list" id="main"');
NOTICE:  HTML:
<ul clear="a&#x22;" wrap="HORIZ&#x22;" dingbat="&#x26A1;" src="d&#x22;" class="energy-list" id="main">
 htp_ulistopen
---------------
(1 row)
select htp_ulistclose();
NOTICE:  HTML:
</ul>
 htp_ulistclose
----------------
(1 row)
select htp_centeropen();
NOTICE:  HTML:
<center>
 htp_centeropen
----------------
(1 row)
select htp_centerclose();
NOTICE:  HTML:
</center>
 htp_centerclose
-----------------
(1 row)
select htp_dirlistopen();
NOTICE:  HTML:
<dir>
 htp_dirlistopen
-----------------
(1 row)
select htp_dirlistclose();
NOTICE:  HTML:
</dir>
 htp_dirlistclose
------------------
(1 row)
select htp_headopen();
NOTICE:  HTML:
<head>
 htp_headopen
--------------
(1 row)
select htp_headclose();
NOTICE:  HTML:
</head>
 htp_headclose
---------------
(1 row)
select htp_htmlopen();
NOTICE:  HTML:
<html>
 htp_htmlopen
--------------
(1 row)
select htp_htmlclose();
NOTICE:  HTML:
</html>
 htp_htmlclose
---------------
(1 row)
select htp_listingopen();
NOTICE:  HTML:
<listing>
 htp_listingopen
-----------------
(1 row)
select htp_listingclose();
NOTICE:  HTML:
</listing>
 htp_listingclose
------------------
(1 row)
select htp_menulistopen();
NOTICE:  HTML:
<menu>
 htp_menulistopen
------------------
(1 row)
select htp_menulistclose();
NOTICE:  HTML:
</menu>
 htp_menulistclose
-------------------
(1 row)
select htp_noframesopen();
NOTICE:  HTML:
<noframes>
 htp_noframesopen
------------------
(1 row)
select htp_noframesclose();
NOTICE:  HTML:
</noframes>
 htp_noframesclose
-------------------
(1 row)
select htp_escape_sc('Россия qwerasdf1234" & . @ '' ');
NOTICE:  HTML:
Россия qwerasdf1234&quot; &amp; . @ ' 
 htp_escape_sc
---------------
(1 row)
select htp_escape_sc('Visit <our site> & enjoy! !@#$%^&*()_+|/');
NOTICE:  HTML:
Visit &lt;our site&gt; &amp; enjoy! !@#$%^&amp;*()_+|/
 htp_escape_sc
---------------
(1 row)
select htp_formcheckbox('"interests', '"travel', '9', 'style="color: blue;"');
NOTICE:  HTML:
<input type="checkbox" name="&#x22;interests" value="&#x22;travel" checked="checked" style="color: blue;" />
 htp_formcheckbox
------------------
(1 row)
select htp_formfile('"interests', '"travel', 'style="color: blue;"');
NOTICE:  HTML:
<input type="file" name="&#x22;interests" accept="&#x22;travel" style="color: blue;" />
 htp_formfile
--------------
(1 row)
select htp_formhidden('"i', '"t', 'style="c"');
NOTICE:  HTML:
<input type="hidden" name="&#x22;i" value="&#x22;t" style="c" />
 htp_formhidden
----------------
(1 row)
select htp_formimage('"i', '"t', '"','style="c"');
NOTICE:  HTML:
<input type="image" name="&#x22;i" src="&#x22;t" align="&#x22;" style="c" />
 htp_formimage
---------------
(1 row)
select htp_formpassword('"i', '"t', '"','"w"', 'style="c"');
NOTICE:  HTML:
<input type="password" name="&#x22;i" size="&#x22;t" maxlength="&#x22;" value="&#x22;w&#x22;" style="c" />
 htp_formpassword
------------------
(1 row)
select htp_formradio('"i', '"t', '"', 'style="c"');
NOTICE:  HTML:
<input type="radio" name="&#x22;i" value="&#x22;t" checked="checked" style="c" />
 htp_formradio
---------------
(1 row)
select htp_formreset('"i', 'style="c"');
NOTICE:  HTML:
<input type="reset" VALUE="&#x22;i" style="c" />
 htp_formreset
---------------
(1 row)
select htp_formselectoption('"i', '"','style="c"');
NOTICE:  HTML:
<option selected="selected" style="c">&quot;i</option>
 htp_formselectoption
----------------------
(1 row)
select htp_formsubmit('"i', '"','style="c"');
NOTICE:  HTML:
<input type="submit" name="&#x22;i" value="&#x22;" style="c" />
 htp_formsubmit
----------------
(1 row)
select htp_formtext('"i', '"','"9"', '"2"', 'style="c"');
NOTICE:  HTML:
<input type="text" name="&#x22;i" size="&#x22;" maxlength="&#x22;9&#x22;" value="&#x22;2&#x22;" style="c" />
 htp_formtext
--------------
(1 row)
select htp_formtextarea('"i', 2, 9, '"2"', 'style="c"');
NOTICE:  HTML:
<textarea name="&#x22;i" rows="2" cols="9" align="&#x22;2&#x22;" style="c"></textarea>
 htp_formtextarea
------------------
(1 row)
select htp_formtextarea2('"i', 2.9, 9, '"2"', ' ', 'style="c"');
NOTICE:  HTML:
<textarea name="&#x22;i" rows="2.9" cols="9" align="&#x22;2&#x22;" wrap="&#x20;" style="c"></textarea>
 htp_formtextarea2
-------------------
(1 row)
select htp_address(NULL, '', 'Б"al l*', 'style="font-style: italic;"');
NOTICE:  HTML:
<address clear="&#x0411;&#x22;al&#x20;l&#x2A;" style="font-style: italic;"></address>
 htp_address
-------------
(1 row)
select htp_anchor(NULL, 'NEW* сайт', 'x"в', 'class="external"');
NOTICE:  HTML:
<a name="x&#x22;&#x0432;" class="external">NEW* &#x0441;&#x0430;&#x0439;&#x0442;</a>
 htp_anchor
------------
(1 row)
select htp_area('x"в','x"в','x"в','x"в','x"в', 'b"Я');
NOTICE:  HTML:
<area shape="x&#x22;&#x0432;" coord="x&#x22;&#x0432;" href="x&quot;в" nohref="nohref" target="x&#x22;&#x0432;" b"Я />
 htp_area
----------
(1 row)
-- htp_em tests
select htp_em('NICE');
DO $$
BEGIN
    perform htp_em('NICE');
    perform htp_em('найс'); -- converts russian symbols in html unicode codes
    perform htp_em('🙂'); -- emoji is converted to html unicode too
    perform htp_em('<script>alert(1)</script>');
    perform htp_em('Test ''Single Quotes''');
    perform htp_em('A < B > C & D');
    perform htp_em('Tab s Here');
    perform htp_em('Line
Break');
    perform htp_em('');              -- Empty string
    perform htp_em(NULL);            -- NULL value
    perform htp_em(' ');             -- Single space
    perform htp_em('Emphasized', 'class="highlight"');
    perform htp_em('Text', 'style="font-weight: bold;"');
    perform htp_em('Link', 'id="my-id"');
    perform htp_em('Mixed', 'class="test" id="x" style="color:red"');
    perform htp_em('<script>', 'onclick="alert(1)"');
    perform htp_em('Text', 'data-value="<script>"');
    perform htp_em('Emphasized');
    perform htp_em(NULL, 'class="test"');
    perform htp_em('Text', NULL);
    perform htp_em('Text', '');
    perform htp_em(NULL, NULL);
    perform htp_get_data();
END $$;
NOTICE:  HTML: 
<em>NICE</em>
 htp_em
--------
(1 row)
select htp_em('найс'); -- converts russian symbols in html unicode codes
NOTICE:  HTML:
<em>&#x043D;&#x0430;&#x0439;&#x0441;</em>
 htp_em
--------
(1 row)
select htp_em('🙂'); -- emoji is converted to html unicode too
NOTICE:  HTML:
<em>&#x01F642;</em>
 htp_em
--------
(1 row)
select htp_em('<script>alert(1)</script>');
NOTICE:  HTML:
<em>&lt;script&gt;alert(1)&lt;/script&gt;</em>
 htp_em
--------
(1 row)
select htp_em('Test ''Single Quotes''');
NOTICE:  HTML:
<em>Test 'Single Quotes'</em>
 htp_em
--------
(1 row)
select htp_em('A < B > C & D');
NOTICE:  HTML:
<em>A &lt; B &gt; C &amp; D</em>
 htp_em
--------
(1 row)
select htp_em('Tab   s Here');
NOTICE:  HTML:
<em>Tab  s Here</em>
 htp_em
--------
(1 row)
select htp_em('Line
Break');
NOTICE:  HTML:
<em>Line
Break</em>
 htp_em
--------
(1 row)
select htp_em('');              -- Empty string
NOTICE:  HTML:
<em></em>
 htp_em
--------
(1 row)
select htp_em(NULL);            -- NULL value
NOTICE:  HTML:
<em></em>
 htp_em
--------
(1 row)
select htp_em(' ');             -- Single space
NOTICE:  HTML:
<em> </em>
 htp_em
--------
(1 row)
select htp_em('Emphasized', 'class="highlight"');
NOTICE:  HTML:
<em class="highlight">Emphasized</em>
 htp_em
--------
(1 row)
select htp_em('Text', 'style="font-weight: bold;"');
NOTICE:  HTML:
<em style="font-weight: bold;">Text</em>
 htp_em
--------
(1 row)
select htp_em('Link', 'id="my-id"');
NOTICE:  HTML:
<em id="my-id">Link</em>
 htp_em
--------
(1 row)
select htp_em('Mixed', 'class="test" id="x" style="color:red"');
NOTICE:  HTML:
<em class="test" id="x" style="color:red">Mixed</em>
 htp_em
--------
(1 row)
select htp_em('<script>', 'onclick="alert(1)"');
NOTICE:  HTML:
<em onclick="alert(1)">&lt;script&gt;</em>
 htp_em
--------
(1 row)
select htp_em('Text', 'data-value="<script>"');
NOTICE:  HTML:
<em data-value="&lt;script&gt;">Text</em>
 htp_em
--------
(1 row)
select htp_em('Emphasized');
NOTICE:  HTML:
<em>Emphasized</em>
 htp_em
--------
(1 row)
select htp_em(NULL, 'class="test"');
NOTICE:  HTML:
<em class="test"></em>
 htp_em
--------
(1 row)
select htp_em('Text', NULL);
NOTICE:  HTML:
<em>Text</em>
 htp_em
--------
(1 row)
select htp_em('Text', '');
NOTICE:  HTML:
<em>Text</em>
 htp_em
--------
(1 row)
select htp_em(NULL, NULL);
NOTICE:  HTML:
<em></em>
 htp_em
--------
(1 row)
-- htp_frame tests
select htp_frame('https://awww.ru');
DO $$
BEGIN
    perform htp_frame('https://awww.ru');
    perform htp_frame('найс'); -- outputs unicode
    perform htp_frame('<script>alert(1)</script>');
    perform htp_frame('A < B > C & D');
    perform htp_frame('Line
Break');
    perform htp_frame(''); -- Empty string
    perform htp_frame(NULL); -- NULL value
    perform htp_frame(' ');
    perform htp_frame('Col1   Col2  Col3'); -- Tab handling
    perform htp_frame(chr(9) || 'Test' || chr(9));
    perform htp_frame('https://awww.ru', 'art site', '100', '100', 'yes', '555', 'index_rate=100'); -- name escapes space!
    perform htp_frame('https://awww.ru', 'space_test', '1 00', '10 0', 'ye s', '555', 'index_rate=10 0'); -- all attrs are escaping space but not cattr
    perform htp_frame('https://awww.ru', '555', 'abc', 'zyx', '444', 'canresize', 'index_rate=100'); -- attrs are messed up logically
    perform htp_frame('https://awww.ru', 'абв', 'где', 'ёжз', 'ийк', 'лмн', 'index_rate=опр'); -- attrs are escaping unicode, noresize is ok, cattrs is not escaped
    perform htp_frame('https://awww.ru', 'symbols_linebreaks_test', 'F < G > H & I',
   'J < K >
    L & M', 'E < O > P & N',
   'Q < R > S & T', 'U < V > W & X');
    perform htp_frame('https://spaces.nul0', '', '', '', '', '', '');
    perform htp_frame('https://spaces.nul1', ' ', ' ', ' ', ' ', ' ', ' ');
    perform htp_frame('https://symbols.esc', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is escaped as html unicode for attrs
    perform htp_get_data();
END $$;
NOTICE:  HTML: 
<frame src="https://awww.ru" />
 htp_frame
-----------
(1 row)
select htp_frame('найс'); -- outputs unicode
NOTICE:  HTML:
<frame src="найс" />
 htp_frame
-----------
(1 row)
select htp_frame('<script>alert(1)</script>');
NOTICE:  HTML:
<frame src="<script>alert(1)</script>" />
 htp_frame
-----------
(1 row)
select htp_frame('A < B > C & D');
NOTICE:  HTML:
<frame src="A < B > C & D" />
 htp_frame
-----------
(1 row)
select htp_frame('Line
Break');
NOTICE:  HTML:
<frame src="Line
Break" />
 htp_frame
-----------
(1 row)
select htp_frame(''); -- Empty string
NOTICE:  HTML:
<frame src="(null)" />
 htp_frame
-----------
(1 row)
select htp_frame(NULL); -- NULL value
NOTICE:  HTML:
<frame src="(null)" />
 htp_frame
-----------
(1 row)
select htp_frame(' ');
NOTICE:  HTML:
<frame src=" " />
 htp_frame
-----------
(1 row)
select htp_frame('Col1  Col2  Col3'); -- Tab handling
NOTICE:  HTML:
<frame src="Col1  Col2  Col3" />
 htp_frame
-----------
(1 row)
select htp_frame(chr(9) || 'Test' || chr(9));
NOTICE:  HTML:
<frame src="   Test  " />
 htp_frame
-----------
(1 row)
select htp_frame('https://awww.ru', 'art site', '100', '100', 'yes', '555', 'index_rate=100'); -- name escapes space!
NOTICE:  HTML:
<frame src="https://awww.ru" name="art&#x20;site" marginwidth="100" marginheight="100" scrolling="yes" noresize="noresize" index_rate=100 />
 htp_frame
-----------
(1 row)
select htp_frame('https://awww.ru', 'space_test', '1 00', '10 0', 'ye s', '555', 'index_rate=10 0'); -- all attrs are escaping space but not cattr
NOTICE:  HTML:
<frame src="https://awww.ru" name="space_test" marginwidth="1&#x20;00" marginheight="10&#x20;0" scrolling="ye&#x20;s" noresize="noresize" index_rate=10 0 />
 htp_frame
-----------
(1 row)
select htp_frame('https://awww.ru', '555', 'abc', 'zyx', '444', 'canresize', 'index_rate=100'); -- attrs are messed up logically
NOTICE:  HTML:
<frame src="https://awww.ru" name="555" marginwidth="abc" marginheight="zyx" scrolling="444" noresize="noresize" index_rate=100 />
 htp_frame
-----------
(1 row)
select htp_frame('https://awww.ru', 'абв', 'где', 'ёжз', 'ийк', 'лмн', 'index_rate=опр'); -- attrs are escaping unicode, noresize is ok, cattrs is not escaped
NOTICE:  HTML:
<frame src="https://awww.ru" name="&#x0430;&#x0431;&#x0432;" marginwidth="&#x0433;&#x0434;&#x0435;" marginheight="&#x0451;&#x0436;&#x0437;" scrolling="&#x0438;&#x0439;&#x043A;" noresize="noresize" index_rate=опр />
 htp_frame
-----------
(1 row)
select htp_frame('https://awww.ru', 'symbols_linebreaks_test', 'F < G > H & I',
                        'J < K >
                               L & M', 'E < O > P & N',
                        'Q < R > S & T', 'U < V > W & X');
NOTICE:  HTML:
<frame src="https://awww.ru" name="symbols_linebreaks_test" marginwidth="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" marginheight="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;L&#x20;&#x26;&#x20;M" scrolling="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" noresize="noresize" U &lt; V &gt; W & X />
 htp_frame
-----------
(1 row)
select htp_frame('https://spaces.nul0', '', '', '', '', '', '');
NOTICE:  HTML:
<frame src="https://awww.ru" name="symbols_linebreaks_test" marginwidth="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" marginheight="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;&#x20;&#x20;&#x20;&#x20;L&#x20;&#x26;&#x20;M" scrolling="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" noresize="noresize" U &lt; V &gt; W & X />
<frame src="https://spaces.nul0" />
 htp_frame
-----------
(1 row)
select htp_frame('https://spaces.nul1', ' ', ' ', ' ', ' ', ' ', ' ');
NOTICE:  HTML:
<frame src="https://spaces.nul1" name="&#x20;" marginwidth="&#x20;" marginheight="&#x20;" scrolling="&#x20;" noresize="noresize"   />
 htp_frame
-----------
(1 row)
select htp_frame('https://symbols.esc', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is escaped as html unicode for attrs
NOTICE:  HTML:
<frame src="https://symbols.esc" name="&#x5C;n" marginwidth="&#x5C;r" marginheight="&#x5C;t" scrolling="&#x5C;&#x5C;" noresize="noresize" \n />
 htp_frame
-----------
(1 row)
-- htp_header tests
select htp_header(NULL, 'Invalid tag');
DO $$
BEGIN
    perform htp_header(NULL, 'Invalid tag');
    perform htp_header(1, 'Pretty Normal');
    perform htp_header(7, 'Tag overflow'); -- 7 is converted to 6
    perform htp_header(0, 'Invalid 0 tag'); -- 0 is okay
    perform htp_header(13, 'найс'); -- converts russian symbols in html unicode codes
    perform htp_header(-2, '🙂'); -- emoji is converted to html unicode too, -2 is 2
    perform htp_header(-12, '🙂'); -- emoji is converted to html unicode too, -12 is 6
    perform htp_header(1, '<script>alert(1)</script>');
    perform htp_header(1, 'A < B > C & D');
    perform htp_header(1, 'Line
Break');
    perform htp_header(1, '');              -- Empty string
    perform htp_header(1, NULL);            -- NULL value
    perform htp_header(1, ' ');             -- Single space
    perform htp_header(1, 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D');
    perform htp_header(2, '', '', '', '', '');
    perform htp_get_data();
END $$;
NOTICE:  HTML: 
<h>Invalid tag</h>
 htp_header
------------
(1 row)
select htp_header(1, 'Pretty Normal');
NOTICE:  HTML:
<h1>Pretty Normal</h1>
 htp_header
------------
(1 row)
select htp_header(7, 'Tag overflow'); -- 7 is converted to 6
NOTICE:  HTML:
<h6>Tag overflow</h6>
 htp_header
------------
(1 row)
select htp_header(0, 'Invalid 0 tag'); -- 0 is okay
NOTICE:  HTML:
<h0>Invalid 0 tag</h0>
 htp_header
------------
(1 row)
select htp_header(13, 'найс'); -- converts russian symbols in html unicode codes
NOTICE:  HTML:
<h6>&#x043D;&#x0430;&#x0439;&#x0441;</h6>
 htp_header
------------
(1 row)
select htp_header(-2, '🙂'); -- emoji is converted to html unicode too, -2 is 2
NOTICE:  HTML:
<h2>&#x01F642;</h2>
 htp_header
------------
(1 row)
select htp_header(-12, '🙂'); -- emoji is converted to html unicode too, -12 is 6
NOTICE:  HTML:
<h6>&#x01F642;</h6>
 htp_header
------------
(1 row)
select htp_header(1, '<script>alert(1)</script>');
NOTICE:  HTML:
<h1>&lt;script&gt;alert(1)&lt;/script&gt;</h1>
 htp_header
------------
(1 row)
select htp_header(1, 'A < B > C & D');
NOTICE:  HTML:
<h1>A &lt; B &gt; C &amp; D</h1>
 htp_header
------------
(1 row)
select htp_header(1, 'Line
Break');
NOTICE:  HTML:
<h1>Line
Break</h1>
 htp_header
------------
(1 row)
select htp_header(1, '');              -- Empty string
NOTICE:  HTML:
<h1></h1>
 htp_header
------------
(1 row)
select htp_header(1, NULL);            -- NULL value
NOTICE:  HTML:
<h1></h1>
 htp_header
------------
(1 row)
select htp_header(1, ' ');             -- Single space
NOTICE:  HTML:
<h1> </h1>
 htp_header
------------
(1 row)
select htp_header(1, 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D', 'A < B > C & D');
NOTICE:  HTML:
<h1 align="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" nowrap="nowrap" clear="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" A &lt; B &gt; C & D>A &lt; B &gt; C &amp; D</h1>
 htp_header
------------
(1 row)
select htp_header(2, '', '', '', '', '');
NOTICE:  HTML:
<h2></h2>
 htp_header
------------
(1 row)
-- OWA_UTIL.SHOWPAGE extended call form with HTP output
DO $$
BEGIN
@@ -1079,168 +282,2274 @@
NOTICE:  HTP_SHOWPAGE_UTILS_BODY
-- htp_dlistterm tests
select htp_dlistterm();
NOTICE:  HTML:
<dt>
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('anna');
NOTICE:  HTML:
<dt>anna
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm(NULL);
NOTICE:  HTML:
<dt>
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('');
NOTICE:  HTML:
<dt>
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('найс'); -- converts russian symbols in html unicode codes
NOTICE:  HTML:
<dt>&#x043D;&#x0430;&#x0439;&#x0441;
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('🙂'); -- emoji is converted to html unicode too
NOTICE:  HTML:
<dt>&#x01F642;
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('<script>alert(1)</script>');
NOTICE:  HTML:
<dt>&lt;script&gt;alert(1)&lt;/script&gt;
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('A < B > C & D'); -- converts special symbols to html unicode
NOTICE:  HTML:
<dt>A &lt; B &gt; C &amp; D
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('Line
DO $$
BEGIN
    perform htp_dlistterm();
    perform htp_dlistterm('anna');
    perform htp_dlistterm(NULL);
    perform htp_dlistterm('');
    perform htp_dlistterm('найс'); -- converts russian symbols in html unicode codes
    perform htp_dlistterm('🙂'); -- emoji is converted to html unicode too
    perform htp_dlistterm('<script>alert(1)</script>');
    perform htp_dlistterm('A < B > C & D'); -- converts special symbols to html unicode
    perform htp_dlistterm('Line
Break');
    perform htp_dlistterm('some term', 'not clear', 'index_rate=100'); -- cclear escapes space
    perform htp_dlistterm('ийк', 'лмн', 'index_rate=опр');
    perform htp_dlistterm('E < O > P & N', 'Q < R > S & T', 'U < V > W & X');
    perform htp_dlistterm('', '', '');
    perform htp_dlistterm(' ', ' ', ' '); -- cclear escapes space
    perform htp_dlistterm('\n', '\r', '\t'); -- cclear escapes slash
    perform htp_dlistterm(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3', chr(9) || 'Test' || chr(9)); -- cclear escapes tabs
    perform htp_dlistterm(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML: 
<dt>
<dt>anna
<dt>
<dt>
<dt>&#x043D;&#x0430;&#x0439;&#x0441;
<dt>&#x01F642;
<dt>&lt;script&gt;alert(1)&lt;/script&gt;
<dt>A &lt; B &gt; C &amp; D
<dt>Line
Break
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('some term', 'not clear', 'index_rate=100'); -- cclear escapes space
NOTICE:  HTML:
<dt clear="not&#x20;clear" index_rate=100>some term
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('ийк', 'лмн', 'index_rate=опр');
NOTICE:  HTML:
<dt clear="&#x043B;&#x043C;&#x043D;" index_rate=опр>&#x0438;&#x0439;&#x043A;
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('E < O > P & N', 'Q < R > S & T', 'U < V > W & X');
NOTICE:  HTML:
<dt clear="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('', '', '');
NOTICE:  HTML:
<dt>
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm(' ', ' ', ' '); -- cclear escapes space
NOTICE:  HTML:
<dt clear="&#x20;"  > 
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm('\n', '\r', '\t'); -- cclear escapes slash
NOTICE:  HTML:
<dt clear="&#x5C;r" \t>\n
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3', chr(9) || 'Test' || chr(9)); -- cclear escapes tabs
NOTICE:  HTML:
<dt clear="Col1&#x09;Col2&#x09;Col3"   Test  >  Test  
 htp_dlistterm
---------------
(1 row)
select htp_dlistterm(chr(1) || chr(2) || chr(3), chr(27), chr(8));
NOTICE:  HTML:
<dt clear="&#x1B;" >
 htp_dlistterm
---------------
(1 row)
select htp_enable_test_mode(0);
-- htp_adddefaulthtmlhdr tests
DO $$
BEGIN
    perform htp_adddefaulthtmlhdr(TRUE);
    perform htp_em('hello world');
    perform htp_dlistterm('заголовок');
    perform htp_get_data();
    perform htp_adddefaulthtmlhdr(FALSE);
END $$;
NOTICE:  HTML: 
<dt clear="&#x1B;" >
test mode off
Content-type: text/html
Content-length: 98
<em>hello world</em>
<dt>&#x0437;&#x0430;&#x0433;&#x043E;&#x043B;&#x043E;&#x0432;&#x043E;&#x043A;
 htp_enable_test_mode
----------------------
-- htp_base tests
DO $$
BEGIN
    perform htp_base('Normal', 'usage=1');
    perform htp_base(); -- empty
    perform htp_base(NULL);
    perform htp_base('');
    perform htp_base('найс'); -- converts russian symbols in html unicode codes
    perform htp_base('🙂'); -- emoji is converted to html unicode too
    perform htp_base('A < B > C & D'); -- converts special symbols to html unicode
    perform htp_base('Line
Break');
    perform htp_base('some term', 'index_rate=100'); -- target attr escapes space
    perform htp_base('ийк', 'index_rate=опр');
    perform htp_base('E < O > P & N', 'U < V > W & X');
    perform htp_base('', '');
    perform htp_base(' ', ' '); -- all used, target attr escapes space
    perform htp_base('\n', '\t'); -- target attr escapes slash
    perform htp_base(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- target attr escapes tabs
    perform htp_base(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<base target="Normal" usage=1 href="http://">
<base href="http://">
<base href="http://">
<base href="http://">
<base target="&#x043D;&#x0430;&#x0439;&#x0441;" href="http://">
<base target="&#x01F642;" href="http://">
<base target="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" href="http://">
<base target="Line&#x0A;Break" href="http://">
<base target="some&#x20;term" index_rate=100 href="http://">
<base target="&#x0438;&#x0439;&#x043A;" index_rate=опр href="http://">
<base target="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" U &lt; V &gt; W & X href="http://">
<base href="http://">
<base target="&#x20;"   href="http://">
<base target="&#x5C;n" \t href="http://">
<base target="&#x09;Test&#x09;" Col1   Col2  Col3 href="http://">
<base target="&#x01;&#x02;&#x03;"  href="http://">
--htp_basefont tests
DO $$
BEGIN
    perform htp_basefont(-100);
    perform htp_basefont(0);
    perform htp_basefont(100);
    perform htp_basefont(1000);
    perform htp_basefont(1000000);
    perform htp_basefont(999999999999);
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<basefont size="-100">
<basefont size="0">
<basefont size="100">
<basefont size="1000">
<basefont size="1000000">
<basefont size="999999999999">
--htp_bgsound tests
DO $$
BEGIN
    perform htp_bgsound('Normal', 'tag', 'usage=1');
    perform htp_bgsound(NULL);
    perform htp_bgsound('');
    perform htp_bgsound('найс'); -- converts russian symbols in html unicode codes
    perform htp_bgsound('🙂'); -- emoji is converted to html unicode too
    perform htp_bgsound('A < B > C & D', 'A < B > C & D'); -- converts special symbols to html unicode
    perform htp_bgsound('Line
Break', 'Line
Break');
    perform htp_bgsound('some term', 'some term', 'index_rate=100'); -- escapes space
    perform htp_bgsound('ийк', 'абв', 'index_rate=опр');
    perform htp_bgsound('E < O > P & N', 'U < V > W & X');
    perform htp_bgsound('', '');
    perform htp_bgsound(' ', ' '); -- src and loop escape space
    perform htp_bgsound('\n', '\t'); -- src and loop escape slash
    perform htp_bgsound(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- src and loop escape tabs
    perform htp_bgsound(chr(1) || chr(2) || chr(3), chr(27) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<bgsound src="Normal" loop="tag" usage=1>
<bgsound src="">
<bgsound src="">
<bgsound src="&#x043D;&#x0430;&#x0439;&#x0441;">
<bgsound src="&#x01F642;">
<bgsound src="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" loop="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D">
<bgsound src="Line&#x0A;Break" loop="Line&#x0A;Break">
<bgsound src="some&#x20;term" loop="some&#x20;term" index_rate=100>
<bgsound src="&#x0438;&#x0439;&#x043A;" loop="&#x0430;&#x0431;&#x0432;" index_rate=опр>
<bgsound src="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" loop="U&#x20;&#x3C;&#x20;V&#x20;&#x3E;&#x20;W&#x20;&#x26;&#x20;X">
<bgsound src="">
<bgsound src="&#x20;" loop="&#x20;">
<bgsound src="&#x5C;n" loop="&#x5C;t">
<bgsound src="&#x09;Test&#x09;" loop="Col1&#x09;Col2&#x09;Col3">
<bgsound src="&#x01;&#x02;&#x03;" loop="&#x1B;&#x02;&#x03;">
--htp_big tests
DO $$
BEGIN
    perform htp_big('Normal', 'usage=1');
    perform htp_big(NULL);
    perform htp_big('');
    perform htp_big('найс'); -- converts russian symbols in html unicode codes
    perform htp_big('🙂'); -- emoji is converted to html unicode too
    perform htp_big('A < B > C & D'); -- converts special symbols to special html code
    perform htp_big('Line
Break'); -- doesn't convert linebreak
    perform htp_big('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_big('ийк', 'index_rate=опр');
    perform htp_big('E < O > P & N', 'U < V > W & X');
    perform htp_big('', '');
    perform htp_big(' ', ' ');
    perform htp_big('\n', '\t'); -- doesn't escape slash
    perform htp_big(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_big(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<big usage=1>Normal</big>
<big></big>
<big></big>
<big>&#x043D;&#x0430;&#x0439;&#x0441;</big>
<big>&#x01F642;</big>
<big>A &lt; B &gt; C &amp; D</big>
<big>Line
Break</big>
<big index_rate=100>some term</big>
<big index_rate=опр>&#x0438;&#x0439;&#x043A;</big>
<big U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</big>
<big></big>
<big  > </big>
<big \t>\n</big>
<big Col1   Col2  Col3> Test  </big>
<big ></big>
--htp_bold tests
DO $$
BEGIN
    perform htp_bold('Normal', 'usage=1');
    perform htp_bold(NULL);
    perform htp_bold('');
    perform htp_bold('здесь'); -- converts russian symbols in html unicode codes
    perform htp_bold('🙂'); -- emoji is converted to html unicode too
    perform htp_bold('A < B > C & D'); -- converts special symbols to special html code
    perform htp_bold('Line
Break'); -- doesn't convert linebreak
    perform htp_bold('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_bold('ийк', 'index_rate=опр');
    perform htp_bold('E < O > P & N', 'U < V > W & X');
    perform htp_bold('', '');
    perform htp_bold(' ', ' ');
    perform htp_bold('\n', '\t'); -- doesn't escape slash
    perform htp_bold(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_bold(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<b usage=1>Normal</b>
<b></b>
<b></b>
<b>&#x0437;&#x0434;&#x0435;&#x0441;&#x044C;</b>
<b>&#x01F642;</b>
<b>A &lt; B &gt; C &amp; D</b>
<b>Line
Break</b>
<b index_rate=100>some term</b>
<b index_rate=опр>&#x0438;&#x0439;&#x043A;</b>
<b U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</b>
<b></b>
<b  > </b>
<b \t>\n</b>
<b Col1  Col2  Col3> Test  </b>
<b ></b>
--htp_br tests
DO $$
BEGIN
    perform htp_br('Normal', 'usage=1');
    perform htp_br(); -- empty
    perform htp_br(NULL);
    perform htp_br('');
    perform htp_br('камень'); -- converts russian symbols in html unicode codes
    perform htp_br('🙂'); -- emoji is converted to html unicode too
    perform htp_br('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_br('Line
Break'); -- converts linebreak to html unicode codes
    perform htp_br('some term', 'index_rate=100'); -- escapes space
    perform htp_br('ийк', 'index_rate=опр');
    perform htp_br('E < O > P & N', 'U < V > W & X');
    perform htp_br('', '');
    perform htp_br(' ', ' ');
    perform htp_br('\n', '\t'); -- escapes slash
    perform htp_br(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- escapes tabs
    perform htp_br(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<br clear="Normal" usage=1 />
<br />
<br />
<br />
<br clear="&#x043A;&#x0430;&#x043C;&#x0435;&#x043D;&#x044C;" />
<br clear="&#x01F642;" />
<br clear="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" />
<br clear="Line&#x0A;Break" />
<br clear="some&#x20;term" index_rate=100 />
<br clear="&#x0438;&#x0439;&#x043A;" index_rate=опр />
<br clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" U &lt; V &gt; W & X />
<br />
<br clear="&#x20;"   />
<br clear="&#x5C;n" \t />
<br clear="&#x09;Test&#x09;" Col1   Col2  Col3 />
<br clear="&#x01;&#x02;&#x03;"  />
--htp_center tests
DO $$
BEGIN
    perform htp_center('Normal usage');
    perform htp_center(NULL);
    perform htp_center('');
    perform htp_center('лёд'); -- converts russian symbols in html unicode codes
    perform htp_center('🙂'); -- emoji is converted to html unicode too
    perform htp_center('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_center('Line
Break'); -- doesn't escape linebreak
    perform htp_center('\n\t'); -- doesn't escape slash
    perform htp_center(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_center(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<center>Normal usage</center>
<center></center>
<center></center>
<center>&#x043B;&#x0451;&#x0434;</center>
<center>&#x01F642;</center>
<center>A &lt; B &gt; C &amp; D</center>
<center>Line
Break</center>
<center>\n\t</center>
<center> Test  </center>
<center></center>
--htp_cite tests
DO $$
BEGIN
    perform htp_cite('Normal', 'usage=1');
    perform htp_cite(NULL);
    perform htp_cite('');
    perform htp_cite('ножницы'); -- converts russian symbols in html unicode codes
    perform htp_cite('🙂'); -- emoji is converted to html unicode too
    perform htp_cite('A < B > C & D'); -- converts special symbols to special html code
    perform htp_cite('Line
Break'); -- doesn't convert linebreak
    perform htp_cite('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_cite('ийк', 'index_rate=опр');
    perform htp_cite('E < O > P & N', 'U < V > W & X');
    perform htp_cite('', '');
    perform htp_cite(' ', ' ');
    perform htp_cite('\n', '\t'); -- doesn't escape slash
    perform htp_cite(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_cite(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<cite usage=1>Normal</cite>
<cite></cite>
<cite></cite>
<cite>&#x043D;&#x043E;&#x0436;&#x043D;&#x0438;&#x0446;&#x044B;</cite>
<cite>&#x01F642;</cite>
<cite>A &lt; B &gt; C &amp; D</cite>
<cite>Line
Break</cite>
<cite index_rate=100>some term</cite>
<cite index_rate=опр>&#x0438;&#x0439;&#x043A;</cite>
<cite U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</cite>
<cite></cite>
<cite  > </cite>
<cite \t>\n</cite>
<cite Col1  Col2  Col3> Test  </cite>
<cite ></cite>
--htp_code tests
DO $$
BEGIN
    perform htp_code('Normal', 'usage=1');
    perform htp_code(NULL);
    perform htp_code('');
    perform htp_code('бумага'); -- converts russian symbols in html unicode codes
    perform htp_code('🙂'); -- emoji is converted to html unicode too
    perform htp_code('A < B > C & D'); -- converts special symbols to special html code
    perform htp_code('Line
Break'); -- doesn't convert linebreak
    perform htp_code('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_code('ийк', 'index_rate=опр');
    perform htp_code('E < O > P & N', 'U < V > W & X');
    perform htp_code('', '');
    perform htp_code(' ', ' ');
    perform htp_code('\n', '\t'); -- doesn't escape slash
    perform htp_code(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_code(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<code usage=1>Normal</code>
<code></code>
<code></code>
<code>&#x0431;&#x0443;&#x043C;&#x0430;&#x0433;&#x0430;</code>
<code>&#x01F642;</code>
<code>A &lt; B &gt; C &amp; D</code>
<code>Line
Break</code>
<code index_rate=100>some term</code>
<code index_rate=опр>&#x0438;&#x0439;&#x043A;</code>
<code U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</code>
<code></code>
<code  > </code>
<code \t>\n</code>
<code Col1  Col2  Col3> Test  </code>
<code ></code>
--htp_comment tests
DO $$
BEGIN
    perform htp_comment('Normal usage');
    perform htp_comment(NULL);
    perform htp_comment('');
    perform htp_comment('ящерица'); -- converts russian symbols in html unicode codes
    perform htp_comment('🙂'); -- emoji is converted to html unicode too
    perform htp_comment('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_comment('Line
Break'); -- doesn't convert linebreak
    perform htp_comment(' ');
    perform htp_comment('\n\t'); -- doesn't escape slash
    perform htp_comment(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_comment(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<!-- ''Normal usage -->
<!-- ''(null) -->
<!-- ''(null) -->
<!-- ''&#x044F;&#x0449;&#x0435;&#x0440;&#x0438;&#x0446;&#x0430; -->
<!-- ''&#x01F642; -->
<!-- ''A &lt; B &gt; C &amp; D -->
<!-- ''Line
Break -->
<!-- ''  -->
<!-- ''\n\t -->
<!-- ''  Test   -->
<!-- '' -->
--htp_dfn tests
DO $$
BEGIN
    perform htp_dfn('Normal usage');
    perform htp_dfn('Normal usage', 'attr=100');
    perform htp_dfn(NULL);
    perform htp_dfn('');
    perform htp_dfn('колодец'); -- converts russian symbols in html unicode codes
    perform htp_dfn('🙂'); -- emoji is converted to html unicode too
    perform htp_dfn('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_dfn('Line
Break'); -- doesn't convert linebreak
    perform htp_dfn('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_dfn('E < O > P & N', 'U < V > W & X');
    perform htp_dfn('', '');
    perform htp_dfn(' ');
    perform htp_dfn('\n\t'); -- doesn't escape slash
    perform htp_dfn(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_dfn(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<dfn>Normal usage</dfn>
<dfn attr=100>Normal usage</dfn>
<dfn></dfn>
<dfn></dfn>
<dfn>&#x043A;&#x043E;&#x043B;&#x043E;&#x0434;&#x0435;&#x0446;</dfn>
<dfn>&#x01F642;</dfn>
<dfn>A &lt; B &gt; C &amp; D</dfn>
<dfn>Line
Break</dfn>
<dfn index_rate=100>some term</dfn>
<dfn U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</dfn>
<dfn></dfn>
<dfn> </dfn>
<dfn>\n\t</dfn>
<dfn> Test  </dfn>
<dfn></dfn>
--htp_div tests
DO $$
BEGIN
    perform htp_div('Normal', 'usage=1');
    perform htp_div();
    perform htp_div(NULL);
    perform htp_div(NULL, NULL);
    perform htp_div('');
    perform htp_div('пламя'); -- converts russian symbols in html unicode codes
    perform htp_div('🙂'); -- emoji is converted to html unicode too
    perform htp_div('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_div('Line
Break'); -- converts linebreak
    perform htp_div('some term', 'index_rate=100'); -- escapes space
    perform htp_div('ийк', 'index_rate=опр');
    perform htp_div('E < O > P & N', 'U < V > W & X');
    perform htp_div('', '');
    perform htp_div(' ', ' ');
    perform htp_div('\n', '\t'); -- escapes slash
    perform htp_div(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- escapes tabs
    perform htp_div(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<div align="Normal" usage=1>
<div>
<div>
<div>
<div>
<div align="&#x043F;&#x043B;&#x0430;&#x043C;&#x044F;">
<div align="&#x01F642;">
<div align="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D">
<div align="Line&#x0A;Break">
<div align="some&#x20;term" index_rate=100>
<div align="&#x0438;&#x0439;&#x043A;" index_rate=опр>
<div align="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" U &lt; V &gt; W & X>
<div>
<div align="&#x20;"  >
<div align="&#x5C;n" \t>
<div align="&#x09;Test&#x09;" Col1  Col2  Col3>
<div align="&#x01;&#x02;&#x03;" >
--htp_dlistdef tests
DO $$
BEGIN
    perform htp_dlistdef('Normal usage', 'left', 'myValue=66');
    perform htp_dlistdef();
    perform htp_dlistdef(NULL);
    perform htp_dlistdef('');
    perform htp_dlistdef('вода'); -- converts russian symbols in html unicode codes
    perform htp_dlistdef('🙂'); -- emoji is converted to html unicode too
    perform htp_dlistdef('Line
Break'); -- doesn't convert linebreak
    perform htp_dlistdef('some term', 'left right', 'index_rate=100');
    perform htp_dlistdef('ийк', 'абв', 'index_rate=опр');
    perform htp_dlistdef('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
    perform htp_dlistdef('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
    perform htp_dlistdef('', '', '');
    perform htp_dlistdef(' ', ' ', ' ');
    perform htp_dlistdef('\n', '\r', '\t');
    perform htp_dlistdef(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3');
    perform htp_dlistdef(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<dd clear="left" myValue=66>Normal usage
<dd>
<dd>
<dd>
<dd>&#x0432;&#x043E;&#x0434;&#x0430;
<dd>&#x01F642;
<dd>Line
Break
<dd clear="left&#x20;right" index_rate=100>some term
<dd clear="&#x0430;&#x0431;&#x0432;" index_rate=опр>&#x0438;&#x0439;&#x043A;
<dd clear="U&#x20;&#x3C;&#x20;V&#x20;&#x3E;&#x20;W&#x20;&#x26;&#x20;X" U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N
<dd clear="&#x3C;script&#x3E;alert&#x28;55555&#x29;&#x3C;&#x2F;script&#x3E;" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt;>&lt;script&gt;alert(4444)&lt;/script&gt;
<dd>
<dd clear="&#x20;"  >
<dd clear="&#x5C;r" \t>\n
<dd clear="&#x09;Test&#x09;" Col1   Col2  Col3> Test
<dd clear="&#x1B;" >
--htp_escape_sc tests
DO $$
BEGIN
    perform htp_escape_sc('Normal&usage');
    perform htp_escape_sc(NULL); -- nothing at all
    perform htp_escape_sc(''); -- nothing at all
    perform htp_escape_sc('оборот'); -- does not convert russian symbols in html unicode codes
    perform htp_escape_sc('🙂'); -- does not convert emoji to html unicode too
    perform htp_escape_sc('A < B > C & D "'); -- converts special symbols to html unicode codes
    perform htp_escape_sc('Line
Break'); -- does not convert linebreak to html unicode codes
    perform htp_escape_sc(' ');
    perform htp_escape_sc('\n\t'); -- doesn't escape slash
    perform htp_escape_sc(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_escape_sc(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
Normal&amp;usage
оборот
🙂
A &lt; B &gt; C &amp; D &quot;
Line
Break
 
(1 row)
\n\t
   Test

--htp_hr tests
DO $$
BEGIN
    perform htp_hr('left', '/images/line.jpg', 'myValue=66');
    perform htp_hr();
    perform htp_hr(NULL);
    perform htp_hr('');
    perform htp_hr('🙂', '🙂'); -- emoji is converted to html unicode by cclear but not by csrc
    perform htp_hr('Line
Break'); -- converts linebreak
    perform htp_hr('left right', 'some term', 'index_rate 100'); -- space is converted to html unicode by cclear but not by csrc
    perform htp_hr('ийк', 'абв', 'index_rate=опр'); -- csrc doesn't convert russian symbols to unicode
    perform htp_hr('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
    perform htp_hr('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
    perform htp_hr('', '', '');
    perform htp_hr(' ', ' ', ' ');
    perform htp_hr('\n', '\r', '\t'); -- slash is converted to html unicode by cclear but not by csrc
    perform htp_hr(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- tab is converted to html unicode by cclear but not by csrc
    perform htp_hr(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<hr clear="left" src="/images/line.jpg" myValue=66 />
<hr />
<hr />
<hr />
<hr clear="&#x01F642;" src="🙂" />
<hr clear="Line&#x0A;Break" />
<hr clear="left&#x20;right" src="some term" index_rate 100 />
<hr clear="&#x0438;&#x0439;&#x043A;" src="абв" index_rate=опр />
<hr clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" src="U &lt; V &gt; W &amp; X" U &lt; V &gt; W & X />
<hr clear="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" src="&lt;script&gt;alert(55555)&lt;/script&gt;" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt; />
<hr />
<hr clear="&#x20;" src=" "   />
<hr clear="&#x5C;n" src="\r" \t />
<hr clear="&#x09;Test&#x09;" src="  Test  " Col1   Col2  Col3 />
<hr clear="&#x01;&#x02;&#x03;" src=""  />
--htp_htitle tests
DO $$
BEGIN
    perform htp_htitle('Normal&usage');
    perform htp_htitle('заголовок');
    perform htp_htitle('🙂');
    perform htp_htitle('<script>alert(1)</script>');
    perform htp_htitle('A < B > C & D');
    perform htp_htitle('Line
Break');
    perform htp_htitle('');
    perform htp_htitle(NULL);
    perform htp_htitle(' ');
    perform htp_htitle('TITLE', 16, 'align', 'nowrap', 'clear', 'index_rate=100');
    perform htp_htitle('TIT LE', -10, 'ali gn', 'no wrap', 'cle ar', 'index_rate 100');
    perform htp_htitle('Заголовок', 14, 'расположение', 'обертка', 'выключка', 'атрибут');
    perform htp_htitle('🔥💻🚀', 5, '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀', ' ');
    perform htp_htitle('U < V > W & X', 1, 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T');
    perform htp_htitle(' ', 0, ' ', ' ', ' ', ' ');
    perform htp_htitle('\n', 1, '\t', '\\', '\n', '\n');
    perform htp_htitle(chr(9) || 'Test' || chr(9), 2, 'Col1 Col2  Col3', chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3');
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<title>Normal&amp;usage</title><h1>Normal&amp;usage</h1>
<title>&#x0437;&#x0430;&#x0433;&#x043E;&#x043B;&#x043E;&#x0432;&#x043E;&#x043A;</title><h1>&#x0437;&#x0430;&#x0433;&#x043E;&#x043B;&#x043E;&#x0432;&#x043E;&#x043A;</h1>
<title>&#x01F642;</title><h1>&#x01F642;</h1>
<title>&lt;script&gt;alert(1)&lt;/script&gt;</title><h1>&lt;script&gt;alert(1)&lt;/script&gt;</h1>
<title>A &lt; B &gt; C &amp; D</title><h1>A &lt; B &gt; C &amp; D</h1>
<title>Line
Break</title><h1>Line
Break</h1>
<title></title><h1></h1>
<title></title><h1></h1>
<title> </title><h1> </h1>
<title>TITLE</title><h6 align="align" nowrap="nowrap" clear="clear" index_rate=100>TITLE</h6>
<title>TIT LE</title><h6 align="ali&#x20;gn" nowrap="nowrap" clear="cle&#x20;ar" index_rate 100>TIT LE</h6>
<title>&#x0417;&#x0430;&#x0433;&#x043E;&#x043B;&#x043E;&#x0432;&#x043E;&#x043A;</title><h6 align="&#x0440;&#x0430;&#x0441;&#x043F;&#x043E;&#x043B;&#x043E;&#x0436;&#x0435;&#x043D;&#x0438;&#x0435;" nowrap="nowrap" clear="&#x0432;&#x044B;&#x043A;&#x043B;&#x044E;&#x0447;&#x043A;&#x0430;" атрибут>&#x0417;&#x0430;&#x0433;&#x043E;&#x043B;&#x043E;&#x0432;&#x043E;&#x043A;</h6>
<title>&#x01F525;&#x01F4BB;&#x01F680;</title><h5 align="&#x01F525;&#x01F4BB;&#x01F680;" nowrap="nowrap" clear="index_rate&#x3D;&#x01F525;&#x01F4BB;&#x01F680;"  >&#x01F525;&#x01F4BB;&#x01F680;</h5>
<title>U &lt; V &gt; W &amp; X</title><h1 align="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" nowrap="nowrap" clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" Q &lt; R &gt; S & T>U &lt; V &gt; W &amp; X</h1>
<title> </title><h0 align="&#x20;" nowrap="nowrap" clear="&#x20;"  > </h0>
<title>\n</title><h1 align="&#x5C;t" nowrap="nowrap" clear="&#x5C;n" \n>\n</h1>
<title>  Test  </title><h2 align="Col1&#x09;Col2&#x09;Col3" nowrap="nowrap" clear="&#x09;Test&#x09;" Col1   Col2  Col3> Test  </h2>
--htp_img tests
DO $$
BEGIN
    perform htp_img('/images/what.jpg', 'left', 'The horse', 'yes', 'index_rate=100'); -- alt escapes space
    perform htp_img('WHAT?');
    perform htp_img('гора'); -- doesn't convert russian symbols in html unicode codes
    perform htp_img('🙂'); -- emoji is not converted to html unicode too
    perform htp_img('<script>alert(1)</script>');
    perform htp_img('A < B > C & D');
    perform htp_img('Line
Break');
    perform htp_img('');              -- Empty string
    perform htp_img(NULL);            -- NULL value
    perform htp_img(' ');             -- Single space
    perform htp_img('/images/ what.jpg', 'le ft', 'The horse', 'ye s', 'index_rate 100'); -- all attrs are escaping space but not cattr and src
    perform htp_img('пикчр', 'левый', 'Лошадь', 'да', 'атрибут 30'); -- src doesn't escape unicode, alt and align do, cattrs is not escaped
    perform htp_img('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_img('U < V > W & X', 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T');
    perform htp_img('', '', '', '', '');
    perform htp_img(' ', ' ', ' ', ' ', ' ');
    perform htp_img('\n', '\t', '\\', '\n', '\n');
    perform htp_img(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3',
        chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3');
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<img src="/images/what.jpg" align="left" alt="The&#x20;horse" ismap="ismap" index_rate=100 />
<img src="WHAT?" />
<img src="гора" />
<img src="🙂" />
<img src="&lt;script&gt;alert(1)&lt;/script&gt;" />
<img src="A &lt; B &gt; C &amp; D" />
<img src="Line
Break" />
<img src="" />
<img src="" />
<img src=" " />
<img src="/images/ what.jpg" align="le&#x20;ft" alt="The&#x20;horse" ismap="ismap" index_rate 100 />
<img src="пикчр" align="&#x043B;&#x0435;&#x0432;&#x044B;&#x0439;" alt="&#x041B;&#x043E;&#x0448;&#x0430;&#x0434;&#x044C;" ismap="ismap" атрибут 30 />
<img src="🔥💻🚀" align="&#x01F525;&#x01F4BB;&#x01F680;" alt="&#x01F525;&#x01F4BB;&#x01F680;" ismap="ismap" index_rate=🔥💻🚀 />
<img src="U &lt; V &gt; W &amp; X" align="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" alt="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" ismap="ismap" Q &lt; R &gt; S & T />
<img src="" />
<img src=" " align="&#x20;" alt="&#x20;" ismap="ismap"   />
<img src="\n" align="&#x5C;t" alt="&#x5C;&#x5C;" ismap="ismap" \n />
<img src="  Test  " align="Col1&#x09;Col2&#x09;Col3" alt="&#x09;Test&#x09;" ismap="ismap" Col1  Col2  Col3 />
--htp_img2 tests
DO $$
BEGIN
    perform htp_img2('/images/what.jpg', 'left', 'The horse', 'yes', 'map.jpg', 'index_rate=100'); -- alt escapes space
    perform htp_img2('WHAT?');
    perform htp_img2('скала'); -- doesn't convert russian symbols in html unicode codes
    perform htp_img2('🙂'); -- emoji is not converted to html unicode too
    perform htp_img2('<script>alert(1)</script>');
    perform htp_img2('A < B > C & D');
    perform htp_img2('Line
Break');
    perform htp_img2('');              -- Empty string
    perform htp_img2(NULL);            -- NULL value
    perform htp_img2(' ');             -- Single space
    perform htp_img2('/images/ what.jpg', 'le ft', 'The horse', 'ye s', 'map .jpg', 'index_rate 100'); -- all attrs are escaping space but not cattr and src
    perform htp_img2('пикчр', 'левый', 'Лошадь', 'да', 'карта', 'атрибут 30'); -- src doesn't escape unicode, alt and align do, cattrs is not escaped
    perform htp_img2('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_img2('U < V > W & X', 'F < G > H & I', 'J < K > L & M', 'E < O > P & N', 'Q < R > S & T', 'U < V > X & Y');
    perform htp_img2('', '', '', '', '', '');
    perform htp_img2(' ', ' ', ' ', ' ', ' ', ' ');
    perform htp_img2('\n', '\t', '\\', '\n', '\n', '\t');
    perform htp_img2(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3',
        chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
        'Col1  Col2  Col3', 'Col1   Col2  Col3');
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<img src="/images/what.jpg" align="left" alt="The&#x20;horse" ismap="ismap" usemap="map.jpg" index_rate=100 />
<img src="WHAT?" />
<img src="скала" />
<img src="🙂" />
<img src="&lt;script&gt;alert(1)&lt;/script&gt;" />
<img src="A &lt; B &gt; C &amp; D" />
<img src="Line
Break" />
<img src="" />
<img src="" />
<img src=" " />
<img src="/images/ what.jpg" align="le&#x20;ft" alt="The&#x20;horse" ismap="ismap" usemap="map&#x20;.jpg" index_rate 100 />
<img src="пикчр" align="&#x043B;&#x0435;&#x0432;&#x044B;&#x0439;" alt="&#x041B;&#x043E;&#x0448;&#x0430;&#x0434;&#x044C;" ismap="ismap" usemap="&#x043A;&#x0430;&#x0440;&#x0442;&#x0430;" атрибут 30 />
<img src="🔥💻🚀" align="&#x01F525;&#x01F4BB;&#x01F680;" alt="&#x01F525;&#x01F4BB;&#x01F680;" ismap="ismap" usemap="&#x01F525;&#x01F4BB;&#x01F680;" index_rate=🔥💻🚀 />
<img src="U &lt; V &gt; W &amp; X" align="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" alt="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" ismap="ismap" usemap="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" U &lt; V &gt; X & Y />
<img src="" />
<img src=" " align="&#x20;" alt="&#x20;" ismap="ismap" usemap="&#x20;"   />
<img src="\n" align="&#x5C;t" alt="&#x5C;&#x5C;" ismap="ismap" usemap="&#x5C;n" \t />
<img src="  Test  " align="Col1&#x09;Col2&#x09;Col3" alt="&#x09;Test&#x09;" ismap="ismap" usemap="Col1&#x09;Col2&#x09;Col3" Col1 Col2  Col3 />
--htp_isindex tests
DO $$
BEGIN
    perform htp_isindex('Enter the message...', 'https://somesite.ru');
    perform htp_isindex();
    perform htp_isindex(NULL);
    perform htp_isindex('');
    perform htp_isindex('холл'); -- converts russian symbols in html unicode codes
    perform htp_isindex('🙂'); -- emoji is converted to html unicode too
    perform htp_isindex('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_isindex('Line
Break'); -- converts linebreak
    perform htp_isindex('ийк', 'опр');
    perform htp_isindex('E < O > P & N', 'U < V > W & X');
    perform htp_isindex('', '');
    perform htp_isindex(' ', ' '); -- prompt escapes spaces
    perform htp_isindex('\n', '\t'); -- prompt escapes slash
    perform htp_isindex(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- prompt escapes tabs
    perform htp_isindex(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<isindex prompt="Enter&#x20;the&#x20;message..." href="https://somesite.ru">
<isindex>
<isindex>
<isindex>
<isindex prompt="&#x0445;&#x043E;&#x043B;&#x043B;">
<isindex prompt="&#x01F642;">
<isindex prompt="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D">
<isindex prompt="Line&#x0A;Break">
<isindex prompt="&#x0438;&#x0439;&#x043A;" href="опр">
<isindex prompt="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" href="U &lt; V &gt; W &amp; X">
<isindex>
<isindex prompt="&#x20;" href=" ">
<isindex prompt="&#x5C;n" href="\t">
<isindex prompt="&#x09;Test&#x09;" href="Col1   Col2  Col3">
<isindex prompt="&#x01;&#x02;&#x03;" href="">
--htp_line tests
DO $$
BEGIN
    perform htp_line('left', '/images/line.jpg', 'myValue=77');
    perform htp_line();
    perform htp_line(NULL);
    perform htp_line('');
    perform htp_line('🙂', '🙂'); -- emoji is converted to html unicode by cclear but not by csrc
    perform htp_line('Line
Break'); -- converts linebreak
    perform htp_line('left right', 'some term', 'index_rate 100'); -- space is converted to html unicode by cclear but not by csrc
    perform htp_line('ийк', 'абв', 'index_rate=опр'); -- csrc doesn't convert russian symbols to unicode
    perform htp_line('E < O > P & N', 'U < V > W & X', 'U < V > W & X');
    perform htp_line('<script>alert(4444)</script>', '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>');
    perform htp_line('', '', '');
    perform htp_line(' ', ' ', ' ');
    perform htp_line('\n', '\r', '\t'); -- slash is converted to html unicode by cclear but not by csrc
    perform htp_line(chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- tab is converted to html unicode by cclear but not by csrc
    perform htp_line(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<hr clear="left" src="/images/line.jpg" myValue=77 />
<hr />
<hr />
<hr />
<hr clear="&#x01F642;" src="🙂" />
<hr clear="Line&#x0A;Break" />
<hr clear="left&#x20;right" src="some term" index_rate 100 />
<hr clear="&#x0438;&#x0439;&#x043A;" src="абв" index_rate=опр />
<hr clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" src="U &lt; V &gt; W &amp; X" U &lt; V &gt; W & X />
<hr clear="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" src="&lt;script&gt;alert(55555)&lt;/script&gt;" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt; />
<hr />
<hr clear="&#x20;" src=" "   />
<hr clear="&#x5C;n" src="\r" \t />
<hr clear="&#x09;Test&#x09;" src="  Test  " Col1   Col2  Col3 />
<hr clear="&#x01;&#x02;&#x03;" src=""  />
--htp_italic tests
DO $$
BEGIN
    perform htp_italic('This one should be italic', 'usage=27');
    perform htp_italic(NULL);
    perform htp_italic('');
    perform htp_italic('мебель'); -- converts russian symbols in html unicode codes
    perform htp_italic('🙂'); -- emoji is converted to html unicode too
    perform htp_italic('A < B > C & D'); -- converts special symbols to special html code
    perform htp_italic('Line
Break'); -- doesn't convert linebreak
    perform htp_italic('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_italic('ийк', 'index_rate=опр');
    perform htp_italic('E < O > P & N', 'U < V > W & X');
    perform htp_italic('', '');
    perform htp_italic(' ', ' ');
    perform htp_italic('\n', '\t'); -- doesn't escape slash
    perform htp_italic(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_italic(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<i usage=27>This one should be italic</i>
<i></i>
<i></i>
<i>&#x043C;&#x0435;&#x0431;&#x0435;&#x043B;&#x044C;</i>
<i>&#x01F642;</i>
<i>A &lt; B &gt; C &amp; D</i>
<i>Line
Break</i>
<i index_rate=100>some term</i>
<i index_rate=опр>&#x0438;&#x0439;&#x043A;</i>
<i U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</i>
<i></i>
<i  > </i>
<i \t>\n</i>
<i Col1  Col2  Col3> Test  </i>
<i ></i>
--htp_kbd tests
DO $$
BEGIN
    perform htp_kbd('This one should be monospace', 'usage=66');
    perform htp_kbd(NULL);
    perform htp_kbd('');
    perform htp_kbd('зарево'); -- converts russian symbols in html unicode codes
    perform htp_kbd('🙂'); -- emoji is converted to html unicode too
    perform htp_kbd('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_kbd('Line
Break'); -- doesn't convert linebreak
    perform htp_kbd('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_kbd('ийк', 'index_rate=опр');
    perform htp_kbd('E < O > P & N', 'U < V > W & X');
    perform htp_kbd('', '');
    perform htp_kbd(' ', ' ');
    perform htp_kbd('\n', '\t'); -- doesn't escape slash
    perform htp_kbd(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_kbd(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<kbd usage=66>This one should be monospace</kbd>
<kbd></kbd>
<kbd></kbd>
<kbd>&#x0437;&#x0430;&#x0440;&#x0435;&#x0432;&#x043E;</kbd>
<kbd>&#x01F642;</kbd>
<kbd>A &lt; B &gt; C &amp; D</kbd>
<kbd>Line
Break</kbd>
<kbd index_rate=100>some term</kbd>
<kbd index_rate=опр>&#x0438;&#x0439;&#x043A;</kbd>
<kbd U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</kbd>
<kbd></kbd>
<kbd  > </kbd>
<kbd \t>\n</kbd>
<kbd Col1   Col2  Col3> Test  </kbd>
<kbd ></kbd>
--htp_keyboard tests
DO $$
BEGIN
    perform htp_keyboard('This one should be monospace too', 'usage=70');
    perform htp_keyboard(NULL);
    perform htp_keyboard('');
    perform htp_keyboard('корона'); -- converts russian symbols in html unicode codes
    perform htp_keyboard('🙂'); -- emoji is converted to html unicode too
    perform htp_keyboard('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_keyboard('Line
Break'); -- doesn't convert linebreak
    perform htp_keyboard('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_keyboard('ийк', 'index_rate=опр');
    perform htp_keyboard('E < O > P & N', 'U < V > W & X');
    perform htp_keyboard('', '');
    perform htp_keyboard(' ', ' ');
    perform htp_keyboard('\n', '\t'); -- doesn't escape slash
    perform htp_keyboard(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- doesn't escape tabs
    perform htp_keyboard(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<kbd usage=70>This one should be monospace too</kbd>
<kbd></kbd>
<kbd></kbd>
<kbd>&#x043A;&#x043E;&#x0440;&#x043E;&#x043D;&#x0430;</kbd>
<kbd>&#x01F642;</kbd>
<kbd>A &lt; B &gt; C &amp; D</kbd>
<kbd>Line
Break</kbd>
<kbd index_rate=100>some term</kbd>
<kbd index_rate=опр>&#x0438;&#x0439;&#x043A;</kbd>
<kbd U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</kbd>
<kbd></kbd>
<kbd  > </kbd>
<kbd \t>\n</kbd>
<kbd Col1   Col2  Col3> Test  </kbd>
<kbd ></kbd>
--htp_linkrel tests
DO $$
BEGIN
    perform htp_linkrel('stylesheet', '/styles/main.css');
    perform htp_linkrel('style sheet', '/styles/ main.css', 'cascade styles'); -- all attrs are escaping space but not href
    perform htp_linkrel('стили', 'главный.ксс', 'таблицы стилей'); -- all attrs are escaping unicode but not href
    perform htp_linkrel('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_linkrel('<script>alert(22)</script>', '<script>alert(333)</script>', '<script>alert(4444)</script>'); -- href converts special symbols to html codes, others do a html unicode conv
    perform htp_linkrel('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_linkrel('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N'); -- all attrs are escaping line breaks but not href
    perform htp_linkrel('', '', '');
    perform htp_linkrel(' ', ' ', ' ');
    perform htp_linkrel('\\', '\n', '\t'); -- all attrs are escaping slashes but not href
    perform htp_linkrel('\0', '\xFF', '\x41');
    perform htp_linkrel(NULL, NULL, NULL);
    perform htp_linkrel('Col1 Col2  Col3', 'Col1   Col2  Col3', chr(9) || 'Test' || chr(9)); -- all attrs are escaping tabs but not href
    perform htp_linkrel(chr(1) || chr(2) || chr(3), chr(27), chr(8)); -- all attrs are escaping control chars but not href
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<link rel="stylesheet" href="/styles/main.css">
<link rel="style&#x20;sheet" href="/styles/ main.css" title="cascade&#x20;styles">
<link rel="&#x0441;&#x0442;&#x0438;&#x043B;&#x0438;" href="главный.ксс" title="&#x0442;&#x0430;&#x0431;&#x043B;&#x0438;&#x0446;&#x044B;&#x20;&#x0441;&#x0442;&#x0438;&#x043B;&#x0435;&#x0439;">
<link rel="&#x01F525;&#x01F4BB;&#x01F680;" href="🔥💻🚀" title="&#x01F525;&#x01F4BB;&#x01F680;">
<link rel="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" href="&lt;script&gt;alert(333)&lt;/script&gt;" title="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;">
<link rel="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" href="J &lt; K &gt; L &amp; M" title="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<link rel="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" href="J &lt; K &gt;
L &amp; M" title="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<link rel="" href="">
<link rel="&#x20;" href=" " title="&#x20;">
<link rel="&#x5C;&#x5C;" href="\n" title="&#x5C;t">
<link rel="&#x5C;0" href="\xFF" title="&#x5C;x41">
<link rel="" href="">
<link rel="Col1&#x09;Col2&#x09;Col3" href="Col1 Col2  Col3" title="&#x09;Test&#x09;">
<link rel="&#x01;&#x02;&#x03;" href="" title="&#x08;">
--htp_linkrev tests
DO $$
BEGIN
    perform htp_linkrev('htmlpage', '/styles/main.css');
    perform htp_linkrev('style sheet', '/styles/ main.css', 'cascade styles'); -- all attrs are escaping space but not href
    perform htp_linkrev('стили', 'главный.ксс', 'таблицы стилей'); -- all attrs are escaping unicode but not href
    perform htp_linkrev('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_linkrev('<script>alert(22)</script>', '<script>alert(333)</script>', '<script>alert(4444)</script>'); -- href converts special symbols to html codes, others do a html unicode conv
    perform htp_linkrev('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_linkrev('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N'); -- all attrs are escaping line breaks but not href
    perform htp_linkrev('', '', '');
    perform htp_linkrev(' ', ' ', ' ');
    perform htp_linkrev('\\', '\n', '\t'); -- all attrs are escaping slashes but not href
    perform htp_linkrev('\0', '\xFF', '\x41');
    perform htp_linkrev(NULL, NULL, NULL);
    perform htp_linkrev('Col1 Col2  Col3', 'Col1   Col2  Col3', chr(9) || 'Test' || chr(9)); -- all attrs are escaping tabs but not href
    perform htp_linkrev(chr(1) || chr(2) || chr(3), chr(27), chr(8)); -- all attrs are escaping control chars but not href
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<link rev="htmlpage" href="/styles/main.css">
<link rev="style&#x20;sheet" href="/styles/ main.css" title="cascade&#x20;styles">
<link rev="&#x0441;&#x0442;&#x0438;&#x043B;&#x0438;" href="главный.ксс" title="&#x0442;&#x0430;&#x0431;&#x043B;&#x0438;&#x0446;&#x044B;&#x20;&#x0441;&#x0442;&#x0438;&#x043B;&#x0435;&#x0439;">
<link rev="&#x01F525;&#x01F4BB;&#x01F680;" href="🔥💻🚀" title="&#x01F525;&#x01F4BB;&#x01F680;">
<link rev="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" href="&lt;script&gt;alert(333)&lt;/script&gt;" title="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;">
<link rev="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" href="J &lt; K &gt; L &amp; M" title="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<link rev="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" href="J &lt; K &gt;
L &amp; M" title="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<link rev="" href="">
<link rev="&#x20;" href=" " title="&#x20;">
<link rev="&#x5C;&#x5C;" href="\n" title="&#x5C;t">
<link rev="&#x5C;0" href="\xFF" title="&#x5C;x41">
<link rev="" href="">
<link rev="Col1&#x09;Col2&#x09;Col3" href="Col1 Col2  Col3" title="&#x09;Test&#x09;">
<link rev="&#x01;&#x02;&#x03;" href="" title="&#x08;">
--htp_listheader tests
DO $$
BEGIN
    perform htp_listheader(NULL);
    perform htp_listheader('');
    perform htp_listheader('дворец'); -- converts russian symbols in html unicode codes
    perform htp_listheader('🙂'); -- emoji is converted to html unicode too
    perform htp_listheader('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_listheader('Line
Break'); -- doesn't convert linebreak
    perform htp_listheader('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_listheader('ийк', 'index_rate=опр');
    perform htp_listheader('E < O > P & N', 'U < V > W & X');
    perform htp_listheader('', '');
    perform htp_listheader(' ', ' ');
    perform htp_listheader('\n', '\t'); -- doesn't escape slash
    perform htp_listheader(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_listheader(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<lh></lh>
<lh></lh>
<lh>&#x0434;&#x0432;&#x043E;&#x0440;&#x0435;&#x0446;</lh>
<lh>&#x01F642;</lh>
<lh>A &lt; B &gt; C &amp; D</lh>
<lh>Line
Break</lh>
<lh index_rate=100>some term</lh>
<lh index_rate=опр>&#x0438;&#x0439;&#x043A;</lh>
<lh U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</lh>
<lh></lh>
<lh  > </lh>
<lh \t>\n</lh>
<lh Col1 Col2  Col3> Test  </lh>
<lh ></lh>
--htp_listitem tests
DO $$
BEGIN
    perform htp_listitem();
    perform htp_listitem('');              -- Empty string
    perform htp_listitem(NULL);            -- NULL value
    perform htp_listitem(' ');             -- Single space
    perform htp_listitem('list point', 'lef t', '* *', '/something. html', 'index_rate=10 0'); -- only text and cattr don't escape space
    perform htp_listitem('абв', 'где', 'ёжз', 'ийк', 'лмн'); -- text escapes russian symbols
    perform htp_listitem('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_listitem('<script>alert(22)</script>', '<script>alert(333)</script>',
          '<script>alert(4444)</script>', '<script>alert(55555)</script>',
          'index_rate=<script>alert(666666)</script>');
    perform htp_listitem('F < G > H & I', 'J < K > L & M', 'E < O > P & N',
          'Q < R > S & T', 'U < V > W & X'); -- text escapes special symbols to special html code
    perform htp_listitem('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N', 'Q
< R > S & T', 'U < V > W
& X'); -- line break is not escaped in text, cattrs
    perform htp_listitem('', '', '', '', ''); -- '' as null for margins, ' ' as null for noresize
    perform htp_listitem(' ', ' ', ' ', ' ', ' '); -- space is not escaped by text, cattr
    perform htp_listitem('\n', '\r', '\t', '\\', '\n');
    perform htp_listitem('\"', '\x41', '\101', '\0', '\xFF');
    perform htp_listitem('Col1   Col2  Col3', 'Col1   Col2  Col3',
             chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
          'Col1   Col2  Col3'); -- tab is not escaped by text, cattr
    perform htp_listitem(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(7), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<li>
<li>
<li>
<li>
<li clear="lef&#x20;t" dingbat="&#x2A;&#x20;&#x2A;" src="&#x2F;something.&#x20;html" index_rate=10 0>list point
<li clear="&#x0433;&#x0434;&#x0435;" dingbat="&#x0451;&#x0436;&#x0437;" src="&#x0438;&#x0439;&#x043A;" лмн>&#x0430;&#x0431;&#x0432;
<li clear="&#x01F525;&#x01F4BB;&#x01F680;" dingbat="&#x01F525;&#x01F4BB;&#x01F680;" src="&#x01F525;&#x01F4BB;&#x01F680;" index_rate=🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;
<li clear="&#x3C;script&#x3E;alert&#x28;333&#x29;&#x3C;&#x2F;script&#x3E;" dingbat="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" src="&#x3C;script&#x3E;alert&#x28;55555&#x29;&#x3C;&#x2F;script&#x3E;" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt;>&lt;script&gt;alert(22)&lt;/script&gt;
<li clear="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" dingbat="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" src="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" U &lt; V &gt; W & X>F &lt; G &gt; H &amp; I
<li clear="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" dingbat="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" src="Q&#x20;&#x0A;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" U &lt; V &gt; W
& X>F &lt; G &gt;
H &amp; I
<li>
<li clear="&#x20;" dingbat="&#x20;" src="&#x20;"  >
<li clear="&#x5C;r" dingbat="&#x5C;t" src="&#x5C;&#x5C;" \n>\n
<li clear="&#x5C;x41" dingbat="&#x5C;101" src="&#x5C;0" \xFF>\&quot;
<li clear="Col1&#x09;Col2&#x09;Col3" dingbat="&#x09;Test&#x09;" src="&#x09;Test&#x09;" Col1  Col2  Col3>Col1   Col2  Col3
<li clear="&#x1B;" dingbat="&#x08;" src="&#x07;" >
--htp_mailto tests
DO $$
BEGIN
    perform htp_mailto('some@where.net', 'Send email to someone');
    perform htp_mailto('some @where.net', 'Send email to someone', 'Some one', 'index_rate=10 0'); -- only name escapes space
    perform htp_mailto('абв', 'где', 'ёжз', 'ийк'); -- name and text escapes russian symbols
    perform htp_mailto('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_mailto('<script>alert(22)</script>', '<script>alert(333)</script>',
                '<script>alert(4444)</script>', 'index_rate=<script>alert(666666)</script>');
    perform htp_mailto('F < G > H & I', 'J < K > L & M',
                'Q < R > S & T', 'U < V > W & X'); -- caddress, ctext, cattr escapes spec symbols to html codes, cname escapes to unicode
    perform htp_mailto('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N', 'Q
< R > S & T'); -- caddress, ctext, cattr doesn't escape tabs, cname escapes to unicode
    perform htp_mailto('', '', '', '');
    perform htp_mailto(' ', ' ', ' ', ' '); -- space is escaped by cname
    perform htp_mailto('\n', '\r', '\t', '\\');
    perform htp_mailto('\"', '\x41', '\101', '\0');
    perform htp_mailto('Col1  Col2  Col3', 'Col1   Col2  Col3',
                chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9)); -- tab is escaped by cname
    perform htp_mailto(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(7));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<a href="mailto:some@where.net">Send email to someone</a>
<a href="mailto:some @where.net" name="Some&#x20;one" index_rate=10 0>Send email to someone</a>
<a href="mailto:абв" name="&#x0451;&#x0436;&#x0437;" ийк>&#x0433;&#x0434;&#x0435;</a>
<a href="mailto:🔥💻🚀" name="&#x01F525;&#x01F4BB;&#x01F680;" index_rate=🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</a>
<a href="mailto:&lt;script&gt;alert(22)&lt;/script&gt;" name="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt;>&lt;script&gt;alert(333)&lt;/script&gt;</a>
<a href="mailto:F &lt; G &gt; H &amp; I" name="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" U &lt; V &gt; W & X>J &lt; K &gt; L &amp; M</a>
<a href="mailto:F &lt; G &gt;
H &amp; I" name="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" Q
&lt; R &gt; S & T>J &lt; K &gt;
L &amp; M</a>
<a href="mailto:"></a>
<a href="mailto: " name="&#x20;"  > </a>
<a href="mailto:\n" name="&#x5C;t" \\>\r</a>
<a href="mailto:\&quot;" name="&#x5C;101" \0>\x41</a>
<a href="mailto:Col1 Col2  Col3" name="&#x09;Test&#x09;"    Test  >Col1 Col2  Col3</a>
<a href="mailto:" name="&#x08;" ></a>
--htp_mapopen tests
DO $$
BEGIN
    perform htp_mapopen(NULL);
    perform htp_mapopen('');
    perform htp_mapopen('Рыбалка'); -- converts russian symbols in html unicode codes
    perform htp_mapopen('🙂'); -- emoji is converted to html unicode too
    perform htp_mapopen('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_mapopen('Line
Break'); -- doesn't convert linebreak
    perform htp_mapopen('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_mapopen('ийк', 'index_rate=опр');
    perform htp_mapopen('E < O > P & N', 'U < V > W & X');
    perform htp_mapopen('', '');
    perform htp_mapopen(' ', ' ');
    perform htp_mapopen('\n', '\t'); -- doesn't escape slash
    perform htp_mapopen(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_mapopen(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<map name="">
<map name="">
<map name="&#x0420;&#x044B;&#x0431;&#x0430;&#x043B;&#x043A;&#x0430;">
<map name="&#x01F642;">
<map name="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D">
<map name="Line&#x0A;Break">
<map name="some&#x20;term" index_rate=100>
<map name="&#x0438;&#x0439;&#x043A;" index_rate=опр>
<map name="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" U &lt; V &gt; W & X>
<map name="">
<map name="&#x20;"  >
<map name="&#x5C;n" \t>
<map name="&#x09;Test&#x09;" Col1   Col2  Col3>
<map name="&#x01;&#x02;&#x03;" >
--htp_meta tests
DO $$
BEGIN
    perform htp_meta('re fresh', 'Test Site', '3; url=https://www.test.org'); -- everything escapes spaces
    perform htp_meta('абв', 'где', 'ёжз'); -- everything escapes russian symbols
    perform htp_meta('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_meta('<script>alert(22)</script>', '<script>alert(333)</script>',
       '<script>alert(4444)</script>');
    perform htp_meta('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_meta('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N');
    perform htp_meta(NULL, NULL, NULL);
    perform htp_meta('', '', '');
    perform htp_meta(' ', ' ', ' ');
    perform htp_meta('\n', '\r', '\t');
    perform htp_meta('\"', '\x41', '\101');
    perform htp_meta('Col1 Col2  Col3', 'Col1   Col2  Col3',
        chr(9) || 'Test' || chr(9));
    perform htp_meta(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<a http-equiv="re&#x20;fresh" name="Test&#x20;Site" content="3&#x3B;&#x20;url&#x3D;https&#x3A;&#x2F;&#x2F;www.test.org">
<a http-equiv="&#x0430;&#x0431;&#x0432;" name="&#x0433;&#x0434;&#x0435;" content="&#x0451;&#x0436;&#x0437;">
<a http-equiv="&#x01F525;&#x01F4BB;&#x01F680;" name="&#x01F525;&#x01F4BB;&#x01F680;" content="&#x01F525;&#x01F4BB;&#x01F680;">
<a http-equiv="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" name="&#x3C;script&#x3E;alert&#x28;333&#x29;&#x3C;&#x2F;script&#x3E;" content="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;">
<a http-equiv="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" name="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" content="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<a http-equiv="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" name="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" content="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N">
<a http-equiv="" name="" content="">
<a http-equiv="" name="" content="">
<a http-equiv="&#x20;" name="&#x20;" content="&#x20;">
<a http-equiv="&#x5C;n" name="&#x5C;r" content="&#x5C;t">
<a http-equiv="&#x5C;&#x22;" name="&#x5C;x41" content="&#x5C;101">
<a http-equiv="Col1&#x09;Col2&#x09;Col3" name="Col1&#x09;Col2&#x09;Col3" content="&#x09;Test&#x09;">
<a http-equiv="&#x01;&#x02;&#x03;" name="&#x1B;" content="&#x08;">
--htp_nextid tests
DO $$
BEGIN
    perform htp_nextid(NULL);
    perform htp_nextid('');
    perform htp_nextid('Колода');
    perform htp_nextid('🙂');
    perform htp_nextid('A < B > C & D');
    perform htp_nextid('Line
Break');
    perform htp_nextid(' ');
    perform htp_nextid('\n\t');
    perform htp_nextid(chr(9) || 'Test' || chr(9));
    perform htp_nextid(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<nextid n="">
<nextid n="">
<nextid n="&#x041A;&#x043E;&#x043B;&#x043E;&#x0434;&#x0430;">
<nextid n="&#x01F642;">
<nextid n="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D">
<nextid n="Line&#x0A;Break">
<nextid n="&#x20;">
<nextid n="&#x5C;n&#x5C;t">
<nextid n="&#x09;Test&#x09;">
<nextid n="&#x01;&#x02;&#x03;">
--htp_nl tests
DO $$
BEGIN
    perform htp_nl('Normal', 'usage=1');
    perform htp_nl(); -- empty
    perform htp_nl(NULL);
    perform htp_nl('');
    perform htp_nl('дерево'); -- converts russian symbols in html unicode codes
    perform htp_nl('🙂'); -- emoji is converted to html unicode too
    perform htp_nl('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_nl('Line
Break'); -- converts linebreak to html unicode codes
    perform htp_nl('some term', 'index_rate=100'); -- escapes space
    perform htp_nl('ийк', 'index_rate=опр');
    perform htp_nl('E < O > P & N', 'U < V > W & X');
    perform htp_nl('', '');
    perform htp_nl(' ', ' ');
    perform htp_nl('\n', '\t'); -- escapes slash
    perform htp_nl(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- escapes tabs
    perform htp_nl(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<br clear="Normal" usage=1 />
<br />
<br />
<br />
<br clear="&#x0434;&#x0435;&#x0440;&#x0435;&#x0432;&#x043E;" />
<br clear="&#x01F642;" />
<br clear="A&#x20;&#x3C;&#x20;B&#x20;&#x3E;&#x20;C&#x20;&#x26;&#x20;D" />
<br clear="Line&#x0A;Break" />
<br clear="some&#x20;term" index_rate=100 />
<br clear="&#x0438;&#x0439;&#x043A;" index_rate=опр />
<br clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" U &lt; V &gt; W & X />
<br />
<br clear="&#x20;"   />
<br clear="&#x5C;n" \t />
<br clear="&#x09;Test&#x09;" Col1   Col2  Col3 />
<br clear="&#x01;&#x02;&#x03;"  />
--htp_nobr tests
DO $$
BEGIN
    perform htp_nobr(NULL);
    perform htp_nobr('');
    perform htp_nobr('крона'); -- convert russian symbols to html unicode codes
    perform htp_nobr('🙂'); -- converts emoji to html unicode too
    perform htp_nobr('A < B > C & D'); -- converts special symbols to html special codes
    perform htp_nobr('Line
Break'); -- does not convert linebreak
    perform htp_nobr(' ');
    perform htp_nobr('\n\t'); -- doesn't escape slash
    perform htp_nobr(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_nobr(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<nobr></nobr>
<nobr></nobr>
<nobr>&#x043A;&#x0440;&#x043E;&#x043D;&#x0430;</nobr>
<nobr>&#x01F642;</nobr>
<nobr>A &lt; B &gt; C &amp; D</nobr>
<nobr>Line
Break</nobr>
<nobr> </nobr>
<nobr>\n\t</nobr>
<nobr>   Test  </nobr>
<nobr></nobr>
--htp_paragraph tests
DO $$
BEGIN
    perform htp_paragraph();
    perform htp_paragraph('');              -- Empty string
    perform htp_paragraph(NULL);            -- NULL value
    perform htp_paragraph(' ');             -- Single space
    perform htp_paragraph('le ft', 'ye s', 'le ft', 'myAttr= value'); -- calign cclear escape spaces
    perform htp_paragraph('абв', 'где', 'ёжз', 'икл'); -- calign cclear escape russian symbols
    perform htp_paragraph('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_paragraph('<script>alert(22)</script>', '<script>alert(333)</script>',
           '<script>alert(4444)</script>', '<script>alert(55555)</script>');
    perform htp_paragraph('F < G > H & I', 'J < K > L & M',
              'E < O > P & N', 'Q < R > S & T'); -- calign cclear escape spec symbols
    perform htp_paragraph('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N', 'Q < R >
 S & T'); -- calign cclear escape linebreaks
    perform htp_paragraph(NULL, NULL, NULL, NULL);
    perform htp_paragraph('', '', '', '');
    perform htp_paragraph(' ', ' ', ' ', ' '); -- space is escaped by calign cclear
    perform htp_paragraph('\n', '\r', '\t', '\\'); -- slash is escaped by calign cclear
    perform htp_paragraph('\"', '\x41', '\101', '\0');
    perform htp_paragraph('Col1  Col2  Col3', 'Col1   Col2  Col3',
            chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
    perform htp_paragraph(chr(1) || chr(2) || chr(3), chr(27), chr(8), chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<p>
<p>
<p>
<p align="&#x20;">
<p align="le&#x20;ft" clear="le&#x20;ft" nowrap="nowrap" myAttr= value>
<p align="&#x0430;&#x0431;&#x0432;" clear="&#x0451;&#x0436;&#x0437;" nowrap="nowrap" икл>
<p align="&#x01F525;&#x01F4BB;&#x01F680;" clear="&#x01F525;&#x01F4BB;&#x01F680;" nowrap="nowrap" 🔥💻🚀>
<p align="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" clear="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" nowrap="nowrap" &lt;script&gt;alert(55555)&lt;/script&gt;>
<p align="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" clear="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" nowrap="nowrap" Q &lt; R &gt; S & T>
<p align="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" clear="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" nowrap="nowrap" Q &lt; R &gt;
 S & T>
<p>
<p>
<p align="&#x20;" clear="&#x20;" nowrap="nowrap"  >
<p align="&#x5C;n" clear="&#x5C;t" nowrap="nowrap" \\>
<p align="&#x5C;&#x22;" clear="&#x5C;101" nowrap="nowrap" \0>
<p align="Col1&#x09;Col2&#x09;Col3" clear="&#x09;Test&#x09;" nowrap="nowrap"  Test  >
<p align="&#x01;&#x02;&#x03;" clear="&#x08;" nowrap="nowrap" >
--htp_param tests
DO $$
BEGIN
    perform htp_param('F < G >
H & I', 'J < K >
L & M'); -- linebreak is escaped
    perform htp_param('some term', 'index rate'); -- space is escaped
    perform htp_param('🔥💻🚀', '🔥💻🚀'); -- emoji is escaped
    perform htp_param('ийк', 'опр'); -- russian symbols are escaped
    perform htp_param('E < O > P & N', 'U < V > W & X'); -- spec symbols are escaped
    perform htp_param('', '');
    perform htp_param(' ', ' ');
    perform htp_param('\n', '\t');
    perform htp_param(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3');
    perform htp_param(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<param name=F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I value= "J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" >
<param name=some&#x20;term value= "index&#x20;rate" >
<param name=&#x01F525;&#x01F4BB;&#x01F680; value= "&#x01F525;&#x01F4BB;&#x01F680;" >
<param name=&#x0438;&#x0439;&#x043A; value= "&#x043E;&#x043F;&#x0440;" >
<param name=E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N value= "U&#x20;&#x3C;&#x20;V&#x20;&#x3E;&#x20;W&#x20;&#x26;&#x20;X" >
<param name= value= "" >
<param name=&#x20; value= "&#x20;" >
<param name=&#x5C;n value= "&#x5C;t" >
<param name=&#x09;Test&#x09; value= "Col1&#x09;Col2&#x09;Col3" >
<param name=&#x01;&#x02;&#x03; value= "&#x1B;" >
--htp_plaintext tests
DO $$
BEGIN
    perform htp_plaintext(NULL);
    perform htp_plaintext('');
    perform htp_plaintext('бокал'); -- converts russian symbols in html unicode codes
    perform htp_plaintext('🙂'); -- emoji is converted to html unicode too
    perform htp_plaintext('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_plaintext('Line
Break'); -- doesn't convert linebreak
    perform htp_plaintext('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_plaintext('ийк', 'index_rate=опр');
    perform htp_plaintext('E < O > P & N', 'U < V > W & X');
    perform htp_plaintext('', '');
    perform htp_plaintext(' ', ' ');
    perform htp_plaintext('\n', '\t'); -- doesn't escape slash
    perform htp_plaintext(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_plaintext(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<plaintext></plaintext>
<plaintext></plaintext>
<plaintext>&#x0431;&#x043E;&#x043A;&#x0430;&#x043B;</plaintext>
<plaintext>&#x01F642;</plaintext>
<plaintext>A &lt; B &gt; C &amp; D</plaintext>
<plaintext>Line
Break</plaintext>
<plaintext index_rate=100>some term</plaintext>
<plaintext index_rate=опр>&#x0438;&#x0439;&#x043A;</plaintext>
<plaintext U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</plaintext>
<plaintext></plaintext>
<plaintext  > </plaintext>
<plaintext \t>\n</plaintext>
<plaintext Col1   Col2  Col3> Test  </plaintext>
<plaintext ></plaintext>
--htp_prints tests
DO $$
BEGIN
    perform htp_prints(NULL); -- nothing at all
    perform htp_prints(''); -- nothing at all
    perform htp_prints('дорога'); -- does not convert russian symbols in html unicode codes
    perform htp_prints('🙂'); -- does not convert emoji to html unicode too
    perform htp_prints('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_prints('Line
Break'); -- does not convert linebreak to html unicode codes
    perform htp_prints(' ');
    perform htp_prints('\n\t'); -- doesn't escape slash
    perform htp_prints(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_prints(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
дорога
🙂
A &lt; B &gt; C &amp; D
Line
Break
\n\t
   Test

--htp_ps tests
DO $$
BEGIN
    perform htp_ps(NULL); -- nothing at all
    perform htp_ps(''); -- nothing at all
    perform htp_ps('долгая'); -- does not convert russian symbols in html unicode codes
    perform htp_ps('🙂'); -- does not convert emoji to html unicode too
    perform htp_ps('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_ps('Line
Break'); -- does not convert linebreak to html unicode codes
    perform htp_ps(' ');
    perform htp_ps('\n\t'); -- doesn't escape slash
    perform htp_ps(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_ps(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
долгая
🙂
A &lt; B &gt; C &amp; D
Line
Break
\n\t
   Test

--htp_s tests
DO $$
BEGIN
    perform htp_s(NULL);
    perform htp_s('');
    perform htp_s('пирог'); -- converts russian symbols in html unicode codes
    perform htp_s('🙂'); -- emoji is converted to html unicode too
    perform htp_s('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_s('Line
Break'); -- doesn't convert linebreak
    perform htp_s('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_s('ийк', 'index_rate=опр');
    perform htp_s('E < O > P & N', 'U < V > W & X');
    perform htp_s('', '');
    perform htp_s(' ', ' ');
    perform htp_s('\n', '\t'); -- doesn't escape slash
    perform htp_s(chr(9) || 'Test' || chr(9), 'Col1   Col2  Col3'); -- doesn't escape tabs
    perform htp_s(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<s></s>
<s></s>
<s>&#x043F;&#x0438;&#x0440;&#x043E;&#x0433;</s>
<s>&#x01F642;</s>
<s>A &lt; B &gt; C &amp; D</s>
<s>Line
Break</s>
<s index_rate=100>some term</s>
<s index_rate=опр>&#x0438;&#x0439;&#x043A;</s>
<s U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</s>
<s></s>
<s  > </s>
<s \t>\n</s>
<s Col1  Col2  Col3> Test  </s>
<s ></s>
--htp_strike tests
DO $$
BEGIN
    perform htp_strike(NULL);
    perform htp_strike('');
    perform htp_strike('облако'); -- converts russian symbols in html unicode codes
    perform htp_strike('🙂'); -- emoji is converted to html unicode too
    perform htp_strike('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_strike('Line
Break'); -- doesn't convert linebreak
    perform htp_strike('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_strike('ийк', 'index_rate=опр');
    perform htp_strike('E < O > P & N', 'U < V > W & X');
    perform htp_strike('', '');
    perform htp_strike(' ', ' ');
    perform htp_strike('\n', '\t'); -- doesn't escape slash
    perform htp_strike(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_strike(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<strike></strike>
<strike></strike>
<strike>&#x043E;&#x0431;&#x043B;&#x0430;&#x043A;&#x043E;</strike>
<strike>&#x01F642;</strike>
<strike>A &lt; B &gt; C &amp; D</strike>
<strike>Line
Break</strike>
<strike index_rate=100>some term</strike>
<strike index_rate=опр>&#x0438;&#x0439;&#x043A;</strike>
<strike U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</strike>
<strike></strike>
<strike  > </strike>
<strike \t>\n</strike>
<strike Col1   Col2  Col3> Test  </strike>
<strike ></strike>
--htp_samp tests
DO $$
BEGIN
    perform htp_sample(NULL);
    perform htp_sample('');
    perform htp_sample('провод'); -- converts russian symbols in html unicode codes
    perform htp_sample('🙂'); -- emoji is converted to html unicode too
    perform htp_sample('A < B > C & D'); -- converts special symbols to special html code
    perform htp_sample('Line
Break'); -- doesn't convert linebreak
    perform htp_sample('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_sample('ийк', 'index_rate=опр');
    perform htp_sample('E < O > P & N', 'U < V > W & X');
    perform htp_sample('', '');
    perform htp_sample(' ', ' ');
    perform htp_sample('\n', '\t'); -- doesn't escape slash
    perform htp_sample(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_sample(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<samp></samp>
<samp></samp>
<samp>&#x043F;&#x0440;&#x043E;&#x0432;&#x043E;&#x0434;</samp>
<samp>&#x01F642;</samp>
<samp>A &lt; B &gt; C &amp; D</samp>
<samp>Line
Break</samp>
<samp index_rate=100>some term</samp>
<samp index_rate=опр>&#x0438;&#x0439;&#x043A;</samp>
<samp U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</samp>
<samp></samp>
<samp  > </samp>
<samp \t>\n</samp>
<samp Col1  Col2  Col3> Test  </samp>
<samp ></samp>
--htp_small tests
DO $$
BEGIN
    perform htp_small(NULL);
    perform htp_small('');
    perform htp_small('шарнир'); -- converts russian symbols in html unicode codes
    perform htp_small('🙂'); -- emoji is converted to html unicode too
    perform htp_small('A < B > C & D'); -- converts special symbols to special html code
    perform htp_small('Line
Break'); -- doesn't convert linebreak
    perform htp_small('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_small('ийк', 'index_rate=опр');
    perform htp_small('E < O > P & N', 'U < V > W & X');
    perform htp_small('', '');
    perform htp_small(' ', ' ');
    perform htp_small('\n', '\t'); -- doesn't escape slash
    perform htp_small(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- doesn't escape tabs
    perform htp_small(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<small></small>
<small></small>
<small>&#x0448;&#x0430;&#x0440;&#x043D;&#x0438;&#x0440;</small>
<small>&#x01F642;</small>
<small>A &lt; B &gt; C &amp; D</small>
<small>Line
Break</small>
<small index_rate=100>some term</small>
<small index_rate=опр>&#x0438;&#x0439;&#x043A;</small>
<small U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</small>
<small></small>
<small  > </small>
<small \t>\n</small>
<small Col1 Col2  Col3> Test  </small>
<small ></small>
--htp_script tests
DO $$
BEGIN
    perform htp_script(NULL);
    perform htp_script('');
    perform htp_script('собор'); -- converts russian symbols in html unicode codes
    perform htp_script('🙂'); -- emoji is converted to html unicode too
    perform htp_script('A < B > C & D'); -- converts special symbols to special html code
    perform htp_script('Line
Break'); -- doesn't convert linebreak
    perform htp_script('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_script('ийк', 'index_rate=опр');
    perform htp_script('E < O > P & N', 'U < V > W & X');
    perform htp_script('', '');
    perform htp_script(' ', ' ');
    perform htp_script('\n', '\t'); -- doesn't escape slash
    perform htp_script(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_script(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<script>''</script>
<script>''</script>
<script>'\u0441\u043E\u0431\u043E\u0440'</script>
<script>'\u1F642'</script>
<script>'A \u003C B \u003E C \u0026 D'</script>
<script>'Line\u000ABreak'</script>
<script language="index_rate&#x3D;100">'some term'</script>
<script language="index_rate&#x3D;&#x043E;&#x043F;&#x0440;">'\u0438\u0439\u043A'</script>
<script language="U&#x20;&#x3C;&#x20;V&#x20;&#x3E;&#x20;W&#x20;&#x26;&#x20;X">'E \u003C O \u003E P \u0026 N'</script>
<script>''</script>
<script language="&#x20;">' '</script>
<script language="&#x5C;t">'\u005Cn'</script>
<script language="Col1&#x09;Col2&#x09;Col3">'\u0009Test\u0009'</script>
<script language="&#x1B;">'\u0001\u0002\u0003'</script>
--htp_strong tests
DO $$
BEGIN
    perform htp_strong('Normal', 'usage=1');
    perform htp_strong(NULL);
    perform htp_strong('');
    perform htp_strong('кабриолет'); -- converts russian symbols in html unicode codes
    perform htp_strong('🙂'); -- emoji is converted to html unicode too
    perform htp_strong('A < B > C & D'); -- converts special symbols to special html code
    perform htp_strong('Line
Break'); -- doesn't convert linebreak
    perform htp_strong('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_strong('ийк', 'index_rate=опр');
    perform htp_strong('E < O > P & N', 'U < V > W & X');
    perform htp_strong('', '');
    perform htp_strong(' ', ' ');
    perform htp_strong('\n', '\t'); -- doesn't escape slash
    perform htp_strong(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_strong(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<strong usage=1>Normal</strong>
<strong></strong>
<strong></strong>
<strong>&#x043A;&#x0430;&#x0431;&#x0440;&#x0438;&#x043E;&#x043B;&#x0435;&#x0442;</strong>
<strong>&#x01F642;</strong>
<strong>A &lt; B &gt; C &amp; D</strong>
<strong>Line
Break</strong>
<strong index_rate=100>some term</strong>
<strong index_rate=опр>&#x0438;&#x0439;&#x043A;</strong>
<strong U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</strong>
<strong></strong>
<strong  > </strong>
<strong \t>\n</strong>
<strong Col1   Col2  Col3> Test  </strong>
<strong ></strong>
--htp_style tests
DO $$
BEGIN
    perform htp_style(NULL); -- nothing at all
    perform htp_style(''); -- nothing at all
    perform htp_style('закат'); -- convert russian symbols to html unicode codes
    perform htp_style('🙂'); -- converts emoji to html unicode too
    perform htp_style('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_style('Line
Break'); -- does not convert linebreak to html unicode codes
    perform htp_style(' ');
    perform htp_style('\n\t'); -- doesn't escape slash
    perform htp_style(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_style(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<style></style>
<style></style>
<style>\437\430\43A\430\442</style>
<style>\1F642</style>
<style>A < B > C & D</style>
<style>Line\ABreak</style>
<style> </style>
<style>\\n\\t</style>
<style>\9Test\9</style>
<style>\1\2\3</style>
--htp_sub tests
DO $$
BEGIN
    perform htp_sub('');              -- Empty string
    perform htp_sub(NULL);            -- NULL value
    perform htp_sub(' ');             -- Single space
    perform htp_sub('subscript data');
    perform htp_sub('сапожник'); -- converts russian symbols in html unicode codes
    perform htp_sub('🙂'); -- emoji is converted to html unicode too
    perform htp_sub('yes', 'left', 'myAttr=value');
    perform htp_sub('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
    perform htp_sub('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
    perform htp_sub('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_sub('<script>alert(22)</script>', '<script>alert(333)</script>',
             '<script>alert(4444)</script>');
    perform htp_sub('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_sub('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N'); -- calign cclear escape linebreaks
    perform htp_sub(NULL, NULL, NULL);
    perform htp_sub('', '', '');
    perform htp_sub(' ', ' ', ' '); -- space is escaped by calign
    perform htp_sub('\n', '\r', '\t'); -- slash is escaped by calign
    perform htp_sub('\"', '\x41', '\101');
    perform htp_sub('Col1  Col2  Col3', 'Col1   Col2  Col3',
            chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
    perform htp_sub(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<sub></sub>
<sub></sub>
<sub> </sub>
<sub>subscript data</sub>
<sub>&#x0441;&#x0430;&#x043F;&#x043E;&#x0436;&#x043D;&#x0438;&#x043A;</sub>
<sub>&#x01F642;</sub>
<sub align="left" myAttr=value>yes</sub>
<sub align="le&#x20;ft" myAttr= value>ye s</sub>
<sub align="&#x0433;&#x0434;&#x0435;" ёжз>&#x0430;&#x0431;&#x0432;</sub>
<sub align="&#x01F525;&#x01F4BB;&#x01F680;" 🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</sub>
<sub align="&#x3C;script&#x3E;alert&#x28;333&#x29;&#x3C;&#x2F;script&#x3E;" &lt;script&gt;alert(4444)&lt;/script&gt;>&lt;script&gt;alert(22)&lt;/script&gt;</sub>
<sub align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" E &lt; O &gt; P & N>F &lt; G &gt; H &amp; I</sub>
<sub align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" E &lt; O
&gt; P & N>F &lt; G &gt;
H &amp; I</sub>
<sub></sub>
<sub></sub>
<sub align="&#x20;"  > </sub>
<sub align="&#x5C;r" \t>\n</sub>
<sub align="&#x5C;x41" \101>\&quot;</sub>
<sub align="Col1&#x09;Col2&#x09;Col3"  Test  >Col1 Col2  Col3</sub>
<sub align="&#x1B;" ></sub>
--htp_sup tests
DO $$
BEGIN
    perform htp_sup('');              -- Empty string
    perform htp_sup(NULL);            -- NULL value
    perform htp_sup(' ');             -- Single space
    perform htp_sup('subscript data');
    perform htp_sup('краб'); -- converts russian symbols in html unicode codes
    perform htp_sup('🙂'); -- emoji is converted to html unicode too
    perform htp_sup('yes', 'left', 'myAttr=value');
    perform htp_sup('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
    perform htp_sup('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
    perform htp_sup('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_sup('<script>alert(22)</script>', '<script>alert(333)</script>',
       '<script>alert(4444)</script>');
    perform htp_sup('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_sup('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N'); -- calign cclear escape linebreaks
    perform htp_sup(NULL, NULL, NULL);
    perform htp_sup('', '', '');
    perform htp_sup(' ', ' ', ' '); -- space is escaped by calign
    perform htp_sup('\n', '\r', '\t'); -- slash is escaped by calign
    perform htp_sup('\"', '\x41', '\101');
    perform htp_sup('Col1  Col2  Col3', 'Col1   Col2  Col3',
      chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
    perform htp_sup(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<sup></sup>
<sup></sup>
<sup> </sup>
<sup>subscript data</sup>
<sup>&#x043A;&#x0440;&#x0430;&#x0431;</sup>
<sup>&#x01F642;</sup>
<sup align="left" myAttr=value>yes</sup>
<sup align="le&#x20;ft" myAttr= value>ye s</sup>
<sup align="&#x0433;&#x0434;&#x0435;" ёжз>&#x0430;&#x0431;&#x0432;</sup>
<sup align="&#x01F525;&#x01F4BB;&#x01F680;" 🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</sup>
<sup align="&#x3C;script&#x3E;alert&#x28;333&#x29;&#x3C;&#x2F;script&#x3E;" &lt;script&gt;alert(4444)&lt;/script&gt;>&lt;script&gt;alert(22)&lt;/script&gt;</sup>
<sup align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" E &lt; O &gt; P & N>F &lt; G &gt; H &amp; I</sup>
<sup align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" E &lt; O
&gt; P & N>F &lt; G &gt;
H &amp; I</sup>
<sup></sup>
<sup></sup>
<sup align="&#x20;"  > </sup>
<sup align="&#x5C;r" \t>\n</sup>
<sup align="&#x5C;x41" \101>\&quot;</sup>
<sup align="Col1&#x09;Col2&#x09;Col3"  Test  >Col1 Col2  Col3</sup>
<sup align="&#x1B;" ></sup>
--htp_tablecaption tests
DO $$
BEGIN
    perform htp_tablecaption('');              -- Empty string
    perform htp_tablecaption(NULL);            -- NULL value
    perform htp_tablecaption(' ');             -- Single space
    perform htp_tablecaption('subscript data');
    perform htp_tablecaption('нож'); -- converts russian symbols in html unicode codes
    perform htp_tablecaption('🙂'); -- emoji is converted to html unicode too
    perform htp_tablecaption('yes', 'left', 'myAttr=value');
    perform htp_tablecaption('ye s', 'le ft', 'myAttr= value'); -- calign escapes spaces
    perform htp_tablecaption('абв', 'где', 'ёжз'); -- calign ctext escape russian symbols
    perform htp_tablecaption('🔥💻🚀', '🔥💻🚀', '🔥💻🚀'); -- same
    perform htp_tablecaption('<script>alert(22)</script>', '<script>alert(333)</script>',
             '<script>alert(4444)</script>');
    perform htp_tablecaption('F < G > H & I', 'J < K > L & M', 'E < O > P & N');
    perform htp_tablecaption('F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N'); -- calign cclear escape linebreaks
    perform htp_tablecaption(NULL, NULL, NULL);
    perform htp_tablecaption('', '', '');
    perform htp_tablecaption(' ', ' ', ' '); -- space is escaped by calign
    perform htp_tablecaption('\n', '\r', '\t'); -- slash is escaped by calign
    perform htp_tablecaption('\"', '\x41', '\101');
    perform htp_tablecaption('Col1  Col2  Col3', 'Col1   Col2  Col3',
            chr(9) || 'Test' || chr(9)); -- tab is escaped by calign cclear
    perform htp_tablecaption(chr(1) || chr(2) || chr(3), chr(27), chr(8));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<caption></caption>
<caption></caption>
<caption> </caption>
<caption>subscript data</caption>
<caption>&#x043D;&#x043E;&#x0436;</caption>
<caption>&#x01F642;</caption>
<caption align="left" myAttr=value>yes</caption>
<caption align="le&#x20;ft" myAttr= value>ye s</caption>
<caption align="&#x0433;&#x0434;&#x0435;" ёжз>&#x0430;&#x0431;&#x0432;</caption>
<caption align="&#x01F525;&#x01F4BB;&#x01F680;" 🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</caption>
<caption align="&#x3C;script&#x3E;alert&#x28;333&#x29;&#x3C;&#x2F;script&#x3E;" &lt;script&gt;alert(4444)&lt;/script&gt;>&lt;script&gt;alert(22)&lt;/script&gt;</caption>
<caption align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;L&#x20;&#x26;&#x20;M" E &lt; O &gt; P & N>F &lt; G &gt; H &amp; I</caption>
<caption align="J&#x20;&#x3C;&#x20;K&#x20;&#x3E;&#x20;&#x0A;L&#x20;&#x26;&#x20;M" E &lt; O
&gt; P & N>F &lt; G &gt;
H &amp; I</caption>
<caption></caption>
<caption></caption>
<caption align="&#x20;"  > </caption>
<caption align="&#x5C;r" \t>\n</caption>
<caption align="&#x5C;x41" \101>\&quot;</caption>
<caption align="Col1&#x09;Col2&#x09;Col3"    Test  >Col1 Col2  Col3</caption>
<caption align="&#x1B;" ></caption>
--htp_tabledata tests
DO $$
BEGIN
    perform htp_tabledata('cell');
    perform htp_tabledata('');              -- Empty string
    perform htp_tabledata(NULL);            -- NULL value
    perform htp_tabledata(' ');             -- Single space
    perform htp_tabledata('Todd', 'left', 'rrr10', 'yes', '3', '3', 'index_rate=100');
    perform htp_tabledata('To dd', 'le ft', '1 0', 'ye s', ' 3', ' 3', 'index_rate= 100'); -- all attrs are escaping space but not cvalue and cattr
    perform htp_tabledata('абв', 'где', 'ёжз', 'ийк', 'лмн', 'опр', 'сту'); -- attrs are escaping unicode, cattrs is not escaped
    perform htp_tabledata('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_tabledata('<script>alert()</script>', '<script>alert(1)</script>', '<script>alert(22)</script>',
               '<script>alert(333)</script>', '<script>alert(4444)</script>',
               '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>'); -- cvalue escapes spec symbs to html spec
    perform htp_tabledata('A < B > C & D', 'E < E > E & E', 'F < G > H & I',
               'J < K > L & M', 'E < O > P & N',
               'Q < R > S & T', 'U < V > W & X');
    perform htp_tabledata('A < B >
C & D', 'E < E >
E & E', 'F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N', 'Q
< R > S & T', 'U < V > W
& X'); -- line break is escaped by every attr, not escaped in cattrs, cvalue
    perform htp_tabledata('', '', '', '', '', '', '');
    perform htp_tabledata(' ', ' ', ' ', ' ', ' ', ' ', ' '); -- spaces is not escaped only by cattrs, cvalue
    perform htp_tabledata('\\', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is not escaped in cattrs, cvalue
    perform htp_tabledata('\101', '\"', '\x41', '\101', '\0', '\xFF', '\xFF');
    perform htp_tabledata('""', '"', NULL, NULL, '""', '"', '"');
    perform htp_tabledata('Col1  Col2  Col3', 'Col1   Col2  Col3', 'Col1   Col2  Col3',
               chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
                'Col1   Col2  Col3', chr(9) || 'Test' || chr(9));
    perform htp_tabledata(chr(1) || chr(2) || chr(3), chr(1) || chr(2) || chr(3), chr(27),
                    chr(8), chr(7), chr(8), chr(7));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<td>cell</td>
<td></td>
<td></td>
<td> </td>
<td align="left" dp="rrr10" rowspan="3" colspan="3" nowrap="nowrap" index_rate=100>Todd</td>
<td align="le&#x20;ft" dp="1&#x20;0" rowspan="&#x20;3" colspan="&#x20;3" nowrap="nowrap" index_rate= 100>To dd</td>
<td align="&#x0433;&#x0434;&#x0435;" dp="&#x0451;&#x0436;&#x0437;" rowspan="&#x043B;&#x043C;&#x043D;" colspan="&#x043E;&#x043F;&#x0440;" nowrap="nowrap" сту>&#x0430;&#x0431;&#x0432;</td>
<td align="&#x01F525;&#x01F4BB;&#x01F680;" dp="&#x01F525;&#x01F4BB;&#x01F680;" rowspan="&#x01F525;&#x01F4BB;&#x01F680;" colspan="&#x01F525;&#x01F4BB;&#x01F680;" nowrap="nowrap" index_rate=🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</td>
<td align="&#x3C;script&#x3E;alert&#x28;1&#x29;&#x3C;&#x2F;script&#x3E;" dp="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" rowspan="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" colspan="&#x3C;script&#x3E;alert&#x28;55555&#x29;&#x3C;&#x2F;script&#x3E;" nowrap="nowrap" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt;>&lt;script&gt;alert()&lt;/script&gt;</td>
<td align="E&#x20;&#x3C;&#x20;E&#x20;&#x3E;&#x20;E&#x20;&#x26;&#x20;E" dp="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" rowspan="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" colspan="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" nowrap="nowrap" U &lt; V &gt; W & X>A &lt; B &gt; C &amp; D</td>
<td align="E&#x20;&#x3C;&#x20;E&#x20;&#x3E;&#x20;&#x0A;E&#x20;&#x26;&#x20;E" dp="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" rowspan="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" colspan="Q&#x20;&#x0A;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" nowrap="nowrap" U &lt; V &gt; W
& X>A &lt; B &gt;
C &amp; D</td>
<td></td>
<td align="&#x20;" dp="&#x20;" rowspan="&#x20;" colspan="&#x20;" nowrap="nowrap"  > </td>
<td align="&#x5C;n" dp="&#x5C;r" rowspan="&#x5C;&#x5C;" colspan="&#x5C;n" nowrap="nowrap" \n>\\</td>
<td align="&#x5C;&#x22;" dp="&#x5C;x41" rowspan="&#x5C;0" colspan="&#x5C;xFF" nowrap="nowrap" \xFF>\101</td>
<td align="&#x22;" rowspan="&#x22;&#x22;" colspan="&#x22;" ">&quot;&quot;</td>
<td align="Col1&#x09;Col2&#x09;Col3" dp="Col1&#x09;Col2&#x09;Col3" rowspan="&#x09;Test&#x09;" colspan="Col1&#x09;Col2&#x09;Col3" nowrap="nowrap"   Test  >Col1 Col2  Col3</td>
<td align="&#x01;&#x02;&#x03;" dp="&#x1B;" rowspan="&#x07;" colspan="&#x08;" nowrap="nowrap" ></td>
--htp_tableheader tests
DO $$
BEGIN
    perform htp_tableheader('cell');
    perform htp_tableheader('');              -- Empty string
    perform htp_tableheader(NULL);            -- NULL value
    perform htp_tableheader(' ');             -- Single space
    perform htp_tableheader('Todd', 'left', 'rrr10', 'yes', '3', '3', 'index_rate=100');
    perform htp_tableheader('To dd', 'le ft', '1 0', 'ye s', ' 3', ' 3', 'index_rate= 100'); -- all attrs are escaping space but not cvalue and cattr
    perform htp_tableheader('абв', 'где', 'ёжз', 'ийк', 'лмн', 'опр', 'сту'); -- attrs are escaping unicode, cattrs is not escaped
    perform htp_tableheader('🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', '🔥💻🚀', 'index_rate=🔥💻🚀'); -- same
    perform htp_tableheader('<script>alert()</script>', '<script>alert(1)</script>', '<script>alert(22)</script>',
                    '<script>alert(333)</script>', '<script>alert(4444)</script>',
                   '<script>alert(55555)</script>', 'index_rate=<script>alert(666666)</script>'); -- cvalue escapes spec symbs to html spec
    perform htp_tableheader('A < B > C & D', 'E < E > E & E', 'F < G > H & I',
                     'J < K > L & M', 'E < O > P & N',
                     'Q < R > S & T', 'U < V > W & X');
    perform htp_tableheader('A < B >
C & D', 'E < E >
E & E', 'F < G >
H & I', 'J < K >
L & M', 'E < O
> P & N', 'Q
< R > S & T', 'U < V > W
& X'); -- line break is escaped by every attr, not escaped in cattrs, cvalue
    perform htp_tableheader('', '', '', '', '', '', '');
    perform htp_tableheader(' ', ' ', ' ', ' ', ' ', ' ', ' '); -- spaces is not escaped only by cattrs, cvalue
    perform htp_tableheader('\\', '\n', '\r', '\t', '\\', '\n', '\n'); -- '\' is not escaped in cattrs, cvalue
    perform htp_tableheader('\101', '\"', '\x41', '\101', '\0', '\xFF', '\xFF');
    perform htp_tableheader('""', '"', NULL, NULL, '""', '"', '"');
    perform htp_tableheader('Col1   Col2  Col3', 'Col1   Col2  Col3', 'Col1   Col2  Col3',
                    chr(9) || 'Test' || chr(9), chr(9) || 'Test' || chr(9),
                     'Col1 Col2  Col3', chr(9) || 'Test' || chr(9));
    perform htp_tableheader(chr(1) || chr(2) || chr(3), chr(1) || chr(2) || chr(3), chr(27),
                    chr(8), chr(7), chr(8), chr(7));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<th>cell</th>
<th></th>
<th></th>
<th> </th>
<th align="left" dp="rrr10" rowspan="3" colspan="3" nowrap="nowrap" index_rate=100>Todd</th>
<th align="le&#x20;ft" dp="1&#x20;0" rowspan="&#x20;3" colspan="&#x20;3" nowrap="nowrap" index_rate= 100>To dd</th>
<th align="&#x0433;&#x0434;&#x0435;" dp="&#x0451;&#x0436;&#x0437;" rowspan="&#x043B;&#x043C;&#x043D;" colspan="&#x043E;&#x043F;&#x0440;" nowrap="nowrap" сту>&#x0430;&#x0431;&#x0432;</th>
<th align="&#x01F525;&#x01F4BB;&#x01F680;" dp="&#x01F525;&#x01F4BB;&#x01F680;" rowspan="&#x01F525;&#x01F4BB;&#x01F680;" colspan="&#x01F525;&#x01F4BB;&#x01F680;" nowrap="nowrap" index_rate=🔥💻🚀>&#x01F525;&#x01F4BB;&#x01F680;</th>
<th align="&#x3C;script&#x3E;alert&#x28;1&#x29;&#x3C;&#x2F;script&#x3E;" dp="&#x3C;script&#x3E;alert&#x28;22&#x29;&#x3C;&#x2F;script&#x3E;" rowspan="&#x3C;script&#x3E;alert&#x28;4444&#x29;&#x3C;&#x2F;script&#x3E;" colspan="&#x3C;script&#x3E;alert&#x28;55555&#x29;&#x3C;&#x2F;script&#x3E;" nowrap="nowrap" index_rate=&lt;script&gt;alert(666666)&lt;/script&gt;>&lt;script&gt;alert()&lt;/script&gt;</th>
<th align="E&#x20;&#x3C;&#x20;E&#x20;&#x3E;&#x20;E&#x20;&#x26;&#x20;E" dp="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;H&#x20;&#x26;&#x20;I" rowspan="E&#x20;&#x3C;&#x20;O&#x20;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" colspan="Q&#x20;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" nowrap="nowrap" U &lt; V &gt; W & X>A &lt; B &gt; C &amp; D</th>
<th align="E&#x20;&#x3C;&#x20;E&#x20;&#x3E;&#x20;&#x0A;E&#x20;&#x26;&#x20;E" dp="F&#x20;&#x3C;&#x20;G&#x20;&#x3E;&#x20;&#x0A;H&#x20;&#x26;&#x20;I" rowspan="E&#x20;&#x3C;&#x20;O&#x20;&#x0A;&#x3E;&#x20;P&#x20;&#x26;&#x20;N" colspan="Q&#x20;&#x0A;&#x3C;&#x20;R&#x20;&#x3E;&#x20;S&#x20;&#x26;&#x20;T" nowrap="nowrap" U &lt; V &gt; W
& X>A &lt; B &gt;
C &amp; D</th>
<th></th>
<th align="&#x20;" dp="&#x20;" rowspan="&#x20;" colspan="&#x20;" nowrap="nowrap"  > </th>
<th align="&#x5C;n" dp="&#x5C;r" rowspan="&#x5C;&#x5C;" colspan="&#x5C;n" nowrap="nowrap" \n>\\</th>
<th align="&#x5C;&#x22;" dp="&#x5C;x41" rowspan="&#x5C;0" colspan="&#x5C;xFF" nowrap="nowrap" \xFF>\101</th>
<th align="&#x22;" rowspan="&#x22;&#x22;" colspan="&#x22;" ">&quot;&quot;</th>
<th align="Col1&#x09;Col2&#x09;Col3" dp="Col1&#x09;Col2&#x09;Col3" rowspan="&#x09;Test&#x09;" colspan="Col1&#x09;Col2&#x09;Col3" nowrap="nowrap"   Test  >Col1 Col2  Col3</th>
<th align="&#x01;&#x02;&#x03;" dp="&#x1B;" rowspan="&#x07;" colspan="&#x08;" nowrap="nowrap" ></th>
-- htp_teletype tests
DO $$
BEGIN
    perform htp_teletype(NULL);
    perform htp_teletype('');
    perform htp_teletype('Зелено'); -- converts russian symbols in html unicode codes
    perform htp_teletype('🙂'); -- emoji is converted to html unicode too
    perform htp_teletype('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_teletype('Line
Break'); -- doesn't convert linebreak
    perform htp_teletype('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_teletype('ийк', 'index_rate=опр');
    perform htp_teletype('E < O > P & N', 'U < V > W & X');
    perform htp_teletype('', '');
    perform htp_teletype(' ', ' ');
    perform htp_teletype('\n', '\t'); -- doesn't escape slash
    perform htp_teletype(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- doesn't escape tabs
    perform htp_teletype(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<tt></tt>
<tt></tt>
<tt>&#x0417;&#x0435;&#x043B;&#x0435;&#x043D;&#x043E;</tt>
<tt>&#x01F642;</tt>
<tt>A &lt; B &gt; C &amp; D</tt>
<tt>Line
Break</tt>
<tt index_rate=100>some term</tt>
<tt index_rate=опр>&#x0438;&#x0439;&#x043A;</tt>
<tt U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</tt>
<tt></tt>
<tt  > </tt>
<tt \t>\n</tt>
<tt Col1 Col2  Col3> Test  </tt>
<tt ></tt>
-- htp_title tests
DO $$
BEGIN
    perform htp_title(NULL); -- nothing at all
    perform htp_title(''); -- nothing at all
    perform htp_title('много'); -- convert russian symbols to html unicode codes
    perform htp_title('🙂'); -- converts emoji to html unicode too
    perform htp_title('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_title('Line
Break'); -- does not convert linebreak to html unicode codes
    perform htp_title(' ');
    perform htp_title('\n\t'); -- doesn't escape slash
    perform htp_title(chr(9) || 'Test' || chr(9)); -- doesn't escape tabs
    perform htp_title(chr(1) || chr(2) || chr(3));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<title></title>
<title></title>
<title>&#x043C;&#x043D;&#x043E;&#x0433;&#x043E;</title>
<title>&#x01F642;</title>
<title>A &lt; B &gt; C &amp; D</title>
<title>Line
Break</title>
<title> </title>
<title>\n\t</title>
<title>  Test  </title>
<title></title>
--htp_underline tests
DO $$
BEGIN
    perform htp_underline(NULL);
    perform htp_underline('');
    perform htp_underline('уголь'); -- converts russian symbols in html unicode codes
    perform htp_underline('🙂'); -- emoji is converted to html unicode too
    perform htp_underline('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_underline('Line
Break'); -- doesn't convert linebreak
    perform htp_underline('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_underline('ийк', 'index_rate=опр');
    perform htp_underline('E < O > P & N', 'U < V > W & X');
    perform htp_underline('', '');
    perform htp_underline(' ', ' ');
    perform htp_underline('\n', '\t'); -- doesn't escape slash
    perform htp_underline(chr(9) || 'Test' || chr(9), 'Col1 Col2  Col3'); -- doesn't escape tabs
    perform htp_underline(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<u></u>
<u></u>
<u>&#x0443;&#x0433;&#x043E;&#x043B;&#x044C;</u>
<u>&#x01F642;</u>
<u>A &lt; B &gt; C &amp; D</u>
<u>Line
Break</u>
<u index_rate=100>some term</u>
<u index_rate=опр>&#x0438;&#x0439;&#x043A;</u>
<u U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</u>
<u></u>
<u  > </u>
<u \t>\n</u>
<u Col1  Col2  Col3> Test  </u>
<u ></u>
--htp_variable tests
DO $$
BEGIN
    perform htp_variable(NULL);
    perform htp_variable('');
    perform htp_variable('руда'); -- converts russian symbols in html unicode codes
    perform htp_variable('🙂'); -- emoji is converted to html unicode too
    perform htp_variable('A < B > C & D'); -- converts special symbols to html unicode codes
    perform htp_variable('Line
Break'); -- doesn't convert linebreak
    perform htp_variable('some term', 'index_rate=100'); -- doesn't escape space
    perform htp_variable('ийк', 'index_rate=опр');
    perform htp_variable('E < O > P & N', 'U < V > W & X');
    perform htp_variable('', '');
    perform htp_variable(' ', ' ');
    perform htp_variable('\n', '\t'); -- doesn't escape slash
    perform htp_variable(chr(9) || 'Test' || chr(9), 'Col1  Col2  Col3'); -- doesn't escape tabs
    perform htp_variable(chr(1) || chr(2) || chr(3), chr(27));
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<var></var>
<var></var>
<var>&#x0440;&#x0443;&#x0434;&#x0430;</var>
<var>&#x01F642;</var>
<var>A &lt; B &gt; C &amp; D</var>
<var>Line
Break</var>
<var index_rate=100>some term</var>
<var index_rate=опр>&#x0438;&#x0439;&#x043A;</var>
<var U &lt; V &gt; W & X>E &lt; O &gt; P &amp; N</var>
<var></var>
<var  > </var>
<var \t>\n</var>
<var Col1   Col2  Col3> Test  </var>
<var ></var>
--common test
DO $$
BEGIN
    perform htp_htitle('Test HTML doc', 1, 'left', 'yes', 'left', 'myAttr=1');
    perform htp_title('Big Great Test Page');
    perform htp_style('body {background-color: #f0f0f0;}');
    perform htp_linkrel('stylesheet', 'main.css', 'css');
    perform htp_linkrev('author', 'book.html', 'War And Peace');
    perform htp_meta('refresh', 'Test Site', '3;url=https://www.test.org');
    perform htp_hr('left', '/images/line.jpg', 'myAttr=2');
    perform htp_line('right', '/images/line2.jpg', 'myAttr=2.5');
    perform htp_basefont(14);
    perform htp_bgsound('town.mid', '-1', 'myAttr=value');
    perform htp_div('', 'myAttr=3');
    perform htp_header(1, 'Test Header');
    perform htp_frame('https://example.com', 'sample site', '100', '100', 'yes', '555', 'myAttr=3.5');
    perform htp_base('_self', 'myAttr=3.7');
    perform htp_comment('Obsolete data');
    perform htp_code('print("Hello World")', 'myAttr=4');
    perform htp_cite('Cite this', 'myAttr=5');
    perform htp_center('Needs to be centered');
    perform htp_br('linebreak', 'myAttr=6');
    perform htp_em('This needs to be emphasized', 'myAttr=6.5');
    perform htp_bold('This needs to be bolder', 'myAttr=7');
    perform htp_big('This needs to be bigger', 'myAttr=7.5');
    perform htp_img('/images/horse.jpg', 'left', 'Horse.', 'yes', 'myAttr=8');
    perform htp_img2('/images/jaguar.jpg', 'left', 'Tiger.', 'yes', '/images/lion.jpg', 'myAttr=9');
    perform htp_isindex('Enter the message...', 'https://somesite.ru');
    perform htp_italic('This one should be italic', 'myAttr=10');
    perform htp_kbd('This one should be monospace', 'myAttr=11');
    perform htp_keyboard('This one should be monospace too', 'myAttr=12');
    perform htp_dfn('Also italic', 'myAttr=13');
    perform htp_listheader('Coffee List', 'myAttr=14');
    perform htp_listitem('listpoint', 'left', '*', '/something.html', 'myAttr=15');
    perform htp_mailto('some@where.net', 'Send email to someone', 'Someone', 'myAttr=16');
    perform htp_mapopen('Infographic', 'myAttr=17');
    perform htp_mapclose();
    perform htp_nextid('Prefix');
    perform htp_nl('linebreak', 'myAttr=18');
    perform htp_nobr('Oneliner');
    perform htp_wbr();
    perform htp_paragraph('left', 'yes', 'left', 'myAttr=17');
    perform htp_param('length', '18');
    perform htp_plaintext('Fixed-width text', 'myAttr=18');
    perform htp_prints('Normal&usage');
    perform htp_ps('std::vector<int>');
    perform htp_s('Dead option', 'myAttr=19');
    perform htp_strike('Another dead option', 'myAttr=20');
    perform htp_sample('Another monospace sample', 'myAttr=21');
    perform htp_small('This needs to be smaller', 'myAttr=22');
    perform htp_script('alert("The number is negative")', 'javascript');
    perform htp_strong('Make it bolder', 'myAttr=23');
    perform htp_sub('subscript data', 'left', 'myAttr=24');
    perform htp_sup('superscript data', 'right', 'myAttr=25');
    perform htp_tablecaption('Big Main Table', 'right', 'myAttr=26');
    perform htp_tableheader('Cell header', 'left', '10', 'yes', '3', '3', 'myAttr=27');
    perform htp_tabledata('Cell data', 'left', '10', 'yes', '3', '3', 'myAttr=28');
    perform htp_teletype('Teletype text', 'myAttr=29');
    perform htp_underline('Underlined text', 'myAttr=30');
    perform htp_variable('Variable in italics', 'myAttr=31');
    perform htp_get_data();
END $$;
NOTICE:  HTML:
<title>Test HTML doc</title><h1 align="left" nowrap="nowrap" clear="left" myAttr=1>Test HTML doc</h1>
<title>Big Great Test Page</title>
<style>body {background-color: #f0f0f0;}</style>
<link rel="stylesheet" href="main.css" title="css">
<link rev="author" href="book.html" title="War&#x20;And&#x20;Peace">
<a http-equiv="refresh" name="Test&#x20;Site" content="3&#x3B;url&#x3D;https&#x3A;&#x2F;&#x2F;www.test.org">
<hr clear="left" src="/images/line.jpg" myAttr=2 />
<hr clear="right" src="/images/line2.jpg" myAttr=2.5 />
<basefont size="14">
<bgsound src="town.mid" loop="-1" myAttr=value>
<div myAttr=3>
<h1>Test Header</h1>
<frame src="https://example.com" name="sample&#x20;site" marginwidth="100" marginheight="100" scrolling="yes" noresize="noresize" myAttr=3.5 />
<base target="_self" myAttr=3.7 href="http://">
<!-- ''Obsolete data -->
<code myAttr=4>print(&quot;Hello World&quot;)</code>
<cite myAttr=5>Cite this</cite>
<center>Needs to be centered</center>
<br clear="linebreak" myAttr=6 />
<em myAttr=6.5>This needs to be emphasized</em>
<b myAttr=7>This needs to be bolder</b>
<big myAttr=7.5>This needs to be bigger</big>
<img src="/images/horse.jpg" align="left" alt="Horse." ismap="ismap" myAttr=8 />
<img src="/images/jaguar.jpg" align="left" alt="Tiger." ismap="ismap" usemap="&#x2F;images&#x2F;lion.jpg" myAttr=9 />
<isindex prompt="Enter&#x20;the&#x20;message..." href="https://somesite.ru">
<i myAttr=10>This one should be italic</i>
<kbd myAttr=11>This one should be monospace</kbd>
<kbd myAttr=12>This one should be monospace too</kbd>
<dfn myAttr=13>Also italic</dfn>
<lh myAttr=14>Coffee List</lh>
<li clear="left" dingbat="&#x2A;" src="&#x2F;something.html" myAttr=15>listpoint
<a href="mailto:some@where.net" name="Someone" myAttr=16>Send email to someone</a>
<map name="Infographic" myAttr=17>
</map>
<nextid n="Prefix">
<br clear="linebreak" myAttr=18 />
<nobr>Oneliner</nobr>
<wbr>
<p align="left" clear="left" nowrap="nowrap" myAttr=17>
<param name=length value= "18" >
<plaintext myAttr=18>Fixed-width text</plaintext>
Normal&amp;usage
std::vector&lt;int&gt;
<s myAttr=19>Dead option</s>
<strike myAttr=20>Another dead option</strike>
<samp myAttr=21>Another monospace sample</samp>
<small myAttr=22>This needs to be smaller</small>
<script language="javascript">'alert(\u0022The number is negative\u0022)'</script>
<strong myAttr=23>Make it bolder</strong>
<sub align="left" myAttr=24>subscript data</sub>
<sup align="right" myAttr=25>superscript data</sup>
<caption align="right" myAttr=26>Big Main Table</caption>
<th align="left" dp="10" rowspan="3" colspan="3" nowrap="nowrap" myAttr=27>Cell header</th>
<td align="left" dp="10" rowspan="3" colspan="3" nowrap="nowrap" myAttr=28>Cell data</td>
<tt myAttr=29>Teletype text</tt>
<u myAttr=30>Underlined text</u>
<var myAttr=31>Variable in italics</var>