Skip to content

Commit

Permalink
added utf-8 processing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Risto Vaarandi committed Feb 28, 2021
1 parent 016af5b commit 2a38d47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion utf8/SecUtf8.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ sub match {
@matches = map { Encode::encode('UTF-8', $_) } @matches;

# return the array @matches, so that its elements would be mapped to
# SEC match variables $1, $2, ...
# SEC match variables $1, $2, etc. (since Perl wide characters are not
# returned from this function, it will avoid Perl warnings and errors
# when Perl wide characters are written to outputs like files and sockets)

return @matches;
}
Expand Down
4 changes: 2 additions & 2 deletions utf8/test-utf8.sec
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ action=eval %o (require "/etc/sec/perl/SecUtf8.pm"); \
# Note that before returning values of match variables, the SecUtf8::match()
# function converts Perl wide characters back to UTF-8 multibyte characters
# in returned values, and thus the $1 and $2 match variables will hold values
# in UTF-8 encoding (that will avoid warnings and errors from Perl when Perl
# wide characters are written to various outputs like files and sockets).
# in UTF-8 encoding (that will avoid Perl warnings and errors when Perl wide
# characters are written to outputs like files and sockets).

type=Single
ptype=PerlFunc
Expand Down

0 comments on commit 2a38d47

Please sign in to comment.