Skip to content

Commit 2a38d47

Browse files
author
Risto Vaarandi
committed
added utf-8 processing examples
1 parent 016af5b commit 2a38d47

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

utf8/SecUtf8.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ sub match {
4646
@matches = map { Encode::encode('UTF-8', $_) } @matches;
4747

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

5153
return @matches;
5254
}

utf8/test-utf8.sec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ action=eval %o (require "/etc/sec/perl/SecUtf8.pm"); \
2323
# Note that before returning values of match variables, the SecUtf8::match()
2424
# function converts Perl wide characters back to UTF-8 multibyte characters
2525
# in returned values, and thus the $1 and $2 match variables will hold values
26-
# in UTF-8 encoding (that will avoid warnings and errors from Perl when Perl
27-
# wide characters are written to various outputs like files and sockets).
26+
# in UTF-8 encoding (that will avoid Perl warnings and errors when Perl wide
27+
# characters are written to outputs like files and sockets).
2828

2929
type=Single
3030
ptype=PerlFunc

0 commit comments

Comments
 (0)