Server IP : 104.21.38.3 / Your IP : 172.70.188.18 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,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,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/php/82/src/ext/mbstring/ |
Upload File : |
#!/usr/bin/env php <?php if ($argc < 2) { echo "Usage: php gen_rare_cp_bitvec.php ./common_codepoints.txt\n"; return; } $bitvec = array_fill(0, (0xFFFF / 32) + 1, 0xFFFFFFFF); $input = file_get_contents($argv[1]); foreach (explode("\n", $input) as $line) { if (false !== $hashPos = strpos($line, '#')) { $line = substr($line, 0, $hashPos); } $line = trim($line); if ($line === '') { continue; } $range = explode("\t", $line); $start = hexdec($range[0]); $end = hexdec($range[1]); for ($i = $start; $i <= $end; $i++) { $bitvec[$i >> 5] &= ~(1 << ($i & 0x1F)); } } $result = <<<'HEADER' /* Machine-generated file; do not edit! See gen_rare_cp_bitvec.php. * * The below array has one bit for each Unicode codepoint from U+0000 to U+FFFF. * The bit is 1 if the codepoint is considered 'rare' for the purpose of * guessing the text encoding of a string. * * Each 'rare' codepoint which appears in a string when it is interpreted * using a candidate encoding causes the candidate encoding to be treated * as less likely to be the correct one. */ static uint32_t rare_codepoint_bitvec[] = { HEADER; for ($i = 0; $i < 0xFFFF / 32; $i++) { if ($i % 8 === 0) { $result .= "\n"; } else { $result .= " "; } $result .= "0x" . str_pad(dechex($bitvec[$i]), 8, '0', STR_PAD_LEFT) . ","; } $result .= "\n};\n"; file_put_contents(__DIR__ . '/rare_cp_bitvec.h', $result); echo "Done.\n"; ?>