403Webshell
Server IP : 216.92.14.13  /  Your IP : 216.73.216.171
Web Server : Apache
System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64
User : rmlac2fmr ( 1040637)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/bin/simp2trad
#!/usr/local/bin/perl -w

use strict;
use utf8;
use Getopt::Long;

(our $Name = $0) =~ s!.*/!!;

my ($open_bracket, $close_bracket, $help);

GetOptions(
    'open=s' => \$open_bracket,
    'close=s' => \$close_bracket,
    'help|?|h' => \$help,
);

$open_bracket = "[" unless defined $open_bracket;
$close_bracket = "]" unless defined $close_bracket;

if (defined $help || not @ARGV) { # help
    print_usage();
    exit 0;
}

while(<>) {
    require Lingua::ZH::HanConvert;
    if ($Name =~ /trad2simp/i) {
	$_ = Lingua::ZH::HanConvert::simple($_, $open_bracket, $close_bracket);
    } else { # simple -> traditional
	$_ = Lingua::ZH::HanConvert::trad($_, $open_bracket, $close_bracket);
    }
    print;
}


sub print_usage {
print <<'EOF';
USAGE: trad2simp [OPTIONS] [FILES] [-]

  Reads Simplified Chinese text from FILES, and outputs Traditional Chinese.

USAGE: simp2trad [OPTIONS] [FILES] [-]

  Reads Traditional Chinese text from FILES, and outputs Simplified Chinese.

ALL TEXT IS HANDLED IN THE UTF-8 CHARACTER SET.  See below for how to handle
GB2312 or Big5 encoded files.  Use "-" as a filename to read from STDIN.  If
there are source characters which have more than one possible corresponding
target character, then all the possible target characters will be listed in
the output, enclosed by square brackets.

OPTIONS:
 --open=string		} Specify the strings to use to surround a list of
 --close=string		} possible output characters.  Defaults are [ and ].
 --help, -h, -?		Display this help.

EXAMPLES:
Convert UTF-8 Simplified Chinese to UTF-8 Traditional Chinese:
$ simp2trad file.txt

Convert Big5 Traditional Chinese to GB2312 Simplified Chinese:
$ iconv -c -f Big5 -t UTF-8 file.txt |trad2simp - |iconv -c -f UTF-8 -t GB2312

Convert GB2312 Simplified Chinese to Big5 Traditional Chinese:
$ iconv -c -f GB2312 -t UTF-8 file.txt |simp2trad - |iconv -c -f UTF-8 -t Big5

EOF
}

Youez - 2016 - github.com/yon3zu
LinuXploit