From a6c83041cf6cd2db8b2df9625081f214af8bc56a Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 16 Oct 2013 21:25:26 -0600 Subject: [PATCH] Respect 'use bytes' in returning $! and $^E This addresses some of the field problems caused by commit 1500bd919ffeae0f3252f8d1bb28b03b043d328e, but by no means all. If the stringification of $^E or $! is done in the scope of 'use bytes', the UTF-8 flag on the result is now never set. In such scope, the behavior is then the same as it was prior to that commit. The actual behavior will change before v5.20 ships. --- mg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mg.c b/mg.c index 7203547..a4a5eec 100644 --- a/mg.c +++ b/mg.c @@ -762,7 +762,8 @@ S_fixup_errno_string(pTHX_ SV* sv) * potential that we will get it wrong however, especially on short * error message text. (If it turns out to be necessary, we could * also keep track if the current LC_MESSAGES locale is UTF-8) */ - if (! is_ascii_string((U8*) SvPVX_const(sv), SvCUR(sv)) + if (! IN_BYTES /* respect 'use bytes' */ + && ! is_ascii_string((U8*) SvPVX_const(sv), SvCUR(sv)) && is_utf8_string((U8*) SvPVX_const(sv), SvCUR(sv))) { SvUTF8_on(sv); -- 2.7.4