summaryrefslogtreecommitdiff
path: root/regress/ISO2022JP/is_iso2022jp_string
blob: c4489273da443a880cb78bccb29b1e9dd87aa564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env perl


use Dialect::ISO2022JP qw(is_iso2022jp_string);

$string = '������';

use Jcode;

printf "%15s", "jis ... ";
Jcode::convert(\$string, 'jis');
print is_iso2022jp_string($string) ? "ok\n" : "fail\n";

for ('ascii', 'binary', 'sjis', 'euc', 'ucs2', 'utf8') {
    check($_);
}


sub check
{
    my ($code) = @_;

    printf "%15s", "$code ... ";
    Jcode::convert(\$string, $code);
    print is_iso2022jp_string($string) ? "fail\n" : "ok\n";
}