From: Jarkko Hietaniemi Date: Sun, 12 Aug 2001 23:24:18 +0000 (+0000) Subject: If you want you can now add -DUSE_UTF8_SCRIPTS to your cflags X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39e02b423749ca43aca0385eea6257ecde9aee92;p=p5sagit%2Fp5-mst-13.2.git If you want you can now add -DUSE_UTF8_SCRIPTS to your cflags and the Perl will be built to do that by default (adding that will break scripts having non-UTF-8 binary data, such as Latin-1.) p4raw-id: //depot/perl@11656 --- diff --git a/op.c b/op.c index f52ea29..677fe7a 100644 --- a/op.c +++ b/op.c @@ -115,7 +115,7 @@ Perl_pad_allocmy(pTHX_ char *name) if (!(PL_in_my == KEY_our || isALPHA(name[1]) || - (PL_hints & HINT_UTF8 && UTF8_IS_START(name[1])) || + (USE_UTF8_IN_NAMES && UTF8_IS_START(name[1])) || (name[1] == '_' && (int)strlen(name) > 2))) { if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) { diff --git a/toke.c b/toke.c index d535442..52706a3 100644 --- a/toke.c +++ b/toke.c @@ -36,11 +36,14 @@ static I32 utf16rev_textfilter(pTHXo_ int idx, SV *sv, int maxlen); #define XFAKEBRACK 128 #define XENUMMASK 127 -#ifdef EBCDIC -/* For now 'use utf8' does not affect tokenizer on EBCDIC */ -#define UTF (PL_linestr && DO_UTF8(PL_linestr)) +#ifdef USE_UTF8_SCRIPTS +# define UTF (!IN_BYTES) #else -#define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8)) +# ifdef EBCDIC /* For now 'use utf8' does not affect tokenizer on EBCDIC */ +# define UTF (PL_linestr && DO_UTF8(PL_linestr)) +# else +# define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8)) +# endif #endif /* In variables named $^X, these are the legal values for X. diff --git a/utf8.h b/utf8.h index b793db6..c475d0f 100644 --- a/utf8.h +++ b/utf8.h @@ -7,6 +7,15 @@ * */ +/* Use UTF-8 as the default script encoding? + * Turning this on will break scripts having non-UTF8 binary + * data (such as Latin-1) in string literals. */ +#ifdef USE_UTF8_SCRIPTS +# define USE_UTF8_IN_NAMES (!IN_BYTES) +#else +# define USE_UTF8_IN_NAMES (PL_hints & HINT_UTF8) +#endif + #ifdef EBCDIC /* The equivalent of these macros but implementing UTF-EBCDIC are in the following header file: