Server IP : 127.0.0.2 / Your IP : 18.223.209.231 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/perl/5.22.1/ |
Upload File : |
use strict; use warnings; # A tiny private library routine which is a helper to several Perl core # modules, to allow a paradigm to be implemented in a single place. The name, # contents, or even the existence of this file may be changed at any time and # are NOT to be used by anthing outside the Perl core. sub _meta_notation ($) { # Returns a copy of the input string with the nonprintable characters # below 0x100 changed into printables. Any ASCII printables or above 0xFF # are unchanged. (XXX Probably above-Latin1 characters should be # converted to \X{...}) # # \0 .. \x1F (which are "\c@" .. "\c_") are changed into ^@, ^A, ^B, ... # ^Z, ^[, ^\, ^], ^^, ^_ # \c? is changed into ^?. # # The above accounts for all the ASCII-range nonprintables. # # On ASCII platforms, the upper-Latin1-range characters are converted to # Meta notation, so that \xC1 becomes 'M-A', \xE2 becomes 'M-b', etc. # This is how it always has worked, so is continued that way for backwards # compatibility. XXX Wrong, but the way it has always worked is that \x80 # .. \x9F are converted to M- followed by a literal control char. This # probably has escaped attention due to the limited domains this code has # been applied to. ext/SDBM_File/dbu.c does this right. # # On EBCDIC platforms, the upper-Latin1-range characters are converted # into '\x{...}' Meta notation doesn't make sense on EBCDIC platforms # because the ASCII-range printables are a mixture of upper bit set or # not. [A-Za-Z0-9] all have the upper bit set. The underscore likely # doesn't; and other punctuation may or may not. There's no simple # pattern. my $string = shift; $string =~ s/([\0-\037])/ sprintf("^%c",utf8::unicode_to_native(ord($1)^64))/xeg; $string =~ s/\c?/^?/g; if (ord("A") == 65) { $string =~ s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg; } else { no warnings 'experimental::regex_sets'; # Leave alone things above \xff $string =~ s/( (?[ [\x00-\xFF] & [:^print:]])) / sprintf("\\x{%X}", ord($1))/xaeg; } return $string; } 1