<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
#
# msgchecker.pl by Yasuhiro MORIKAWA, 2006

use Jcode;

if ($#ARGV &lt; 1){
    die "Usage: msgchecker.pl [ASCII|euc|sjis|jis|utf8] file\n";
}

$logcode = $ARGV[0];   # 'ASCII', 'euc', 'sjis', 'jis', 'utf8'.
$msg     = $ARGV[1];

if (!$logcode){
    $logcode = 'ASCII';
}

open(MSG, "&lt;$msg")
        || die "$msg: cannot find log message.";

while (&lt;MSG&gt;) {
    undef $code;
    ($code, $nmatch) = getcode(\$_);
    if ($code eq 'binary') {
        die "log message is $code , Please write log message ASCII.\n"
            if ($logcode eq 'ASCII');
        die "log message is $code , Please write log message ASCII or $logcode .\n";
    } elsif ($code eq 'ascii') {
	next;
    } elsif ($code eq $logcode) {
	next;
    } else {
        die "log message is $code , Please write log message ASCII.\n"
            if ($logcode eq 'ASCII');
        die "log message is $code , Please write log message ASCII or $logcode .\n";
    }
}

close(MSG);

exit 0;
</pre></body></html>