1HTML::Mason::Escapes(3)User Contributed Perl DocumentatioHnTML::Mason::Escapes(3)
2
3
4
6 HTML::Mason::Escapes - Functions to escape text for Mason
7
9 This module contains functions for implementing Mason's substitution
10 escaping feature. These functions may also be called directly.
11
12 html_entities_escape
13 This function takes a scalar reference and HTML-escapes it using
14 the "HTML::Entities" module. By default, this module assumes that
15 the string it is escaping is in ISO-8859-1 (pre Perl 5.8.0) or
16 UTF-8 (Perl 5.8.0 onwards). If this is not the case for your data,
17 you will want to override this escape to do the right thing for
18 your encoding. See the section on User-defined Escapes in the
19 Developer's Manual for more details on how to do this.
20
21 url_escape
22 This takes a scalar reference and replaces any text it contains
23 matching "[^a-zA-Z0-9_.-]" with the URL-escaped equivalent, a
24 percent sign (%) followed by the hexadecimal number of that
25 character.
26
27 basic_html_escape
28 This function takes a scalar reference and HTML-escapes it,
29 escaping the following characters: '&', '>', '<', and '"'.
30
31 It is provided for those who wish to use it to replace (or
32 supplement) the existing 'h' escape flag, via the Interpreter's
33 "set_escape()" method.
34
35 This function is provided in order to allow people to return the
36 HTML escaping behavior in 1.0x. However, this behavior presents a
37 potential security risk of allowing cross-site scripting attacks.
38 HTML escaping should always be done based on the character set a
39 page is in. Merely escaping the four characters mentioned above is
40 not sufficient. The quick summary of why is that for some
41 character sets, characters other than '<' may be interpreted as a
42 "less than" sign, meaning that just filtering '<' and '>' will not
43 stop all cross-site scripting attacks. See
44 http://www.megasecurity.org/Info/cross-site_scripting.txt for more
45 details.
46
47
48
49perl v5.32.0 2020-07-28 HTML::Mason::Escapes(3)