summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/encoding.pm14
-rw-r--r--pod/perlunicode.pod3
-rw-r--r--pp_ctl.c14
3 files changed, 18 insertions, 13 deletions
diff --git a/lib/encoding.pm b/lib/encoding.pm
index 33c5113223..fd9d19b572 100644
--- a/lib/encoding.pm
+++ b/lib/encoding.pm
@@ -61,19 +61,13 @@ If no encoding is specified, the environment variable L<PERL_ENCODING>
is consulted. If that fails, "latin1" (ISO 8859-1) is assumed.
If no encoding can be found, C<Unknown encoding '...'> error will be thrown.
-=head1 FUTURE POSSIBILITIES
+=head1 KNOWN PROBLEMS
The C<\x..> and C<\0...> in regular expressions are not affected by
-this pragma. They probably should.
-
-The charnames "\N{...}" does not work with this pragma.
-
-=head1 KNOWN PROBLEMS
+this pragma. They very probably should.
-Cannot be combined with C<use utf8>. Note that this is a problem
-B<only> if you would like to have Unicode identifiers in your scripts.
-You should not need C<use utf8> for anything else these days
-(since Perl 5.8.0).
+The charnames pragma ("\N{LATIN SMALL SHARP LETTER S}") does not work
+with this pragma.
=head1 SEE ALSO
diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod
index a5a69ff727..106a4bf610 100644
--- a/pod/perlunicode.pod
+++ b/pod/perlunicode.pod
@@ -53,8 +53,7 @@ B<NOTE: this should be the only place where an explicit C<use utf8> is
needed>.
You can also use the C<encoding> pragma to change the default encoding
-of the data in your script; see L<encoding>. Currently this cannot
-be combined with C<use utf8>.
+of the data in your script; see L<encoding>.
=back
diff --git a/pp_ctl.c b/pp_ctl.c
index 567370be8b..9e73ca2b71 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3036,6 +3036,8 @@ PP(pp_require)
SV *filter_state = 0;
SV *filter_sub = 0;
SV *hook_sv = 0;
+ SV *encoding;
+ OP *op;
sv = POPs;
if (SvNIOKp(sv)) {
@@ -3379,7 +3381,17 @@ trylocal: {
PL_eval_owner = thr;
MUTEX_UNLOCK(&PL_eval_mutex);
#endif /* USE_5005THREADS */
- return DOCATCH(doeval(gimme, NULL));
+
+ /* Store and reset encoding. */
+ encoding = PL_encoding;
+ PL_encoding = Nullsv;
+
+ op = DOCATCH(doeval(gimme, NULL));
+
+ /* Restore encoding. */
+ PL_encoding = encoding;
+
+ return op;
}
PP(pp_dofile)