#endif /* USE_LOCALE */
{
+ /* Set PL_wantut8 to TRUE if any of the following are true:
+ - nl_langinfo(CODESET) contains /^utf-?8/i
+ - $ENV{LANGUAGE} contains /^utf-?8/i (only if using glibc)
+ - $ENV{LC_CALL} contains /^utf-?8/i
+ - $ENV{LC_CTYPE} contains /^utf-?8/i
+ - $ENV{LANG} contains /^utf-?8/i
+ If PL_wantutf8 is true the perl.c:S_parse_body()
+ will turn on the PerlIO :utf8 discipline on STDIN, STDOUT,
+ STDERR, _and_ the default open discipline.
+ */
bool wantutf8 = FALSE;
char *codeset = NULL;
#if defined(HAS_NL_LANGINFO) && defined(CODESET)
if (!PL_do_undump)
init_postdump_symbols(argc,argv,env);
+ /* PL_wantutf8 is conditionally turned on by
+ * locale.c:Perl_init_i18nl10n() if the environment
+ * look like the user wants to use UTF-8. */
if (PL_wantutf8) { /* Requires init_predump_symbols(). */
IO* io;
PerlIO* fp;
SV* sv;
+ /* Turn on UTF-8-ness on STDIN, STDOUT, STDERR
+ * _and_ the default open discipline. */
if (PL_stdingv && (io = GvIO(PL_stdingv)) && (fp = IoIFP(io)))
PerlIO_binmode(aTHX_ fp, IoTYPE(io), 0, ":utf8");
if (PL_defoutgv && (io = GvIO(PL_defoutgv)) && (fp = IoOFP(io)))