Костик сделал перловый скрипт, который русские тексты переводит в 0x266-подобные крокозаблы. Вот он (если форумом не покоцается). Файлы ему надо давать в виде:
LineBegin
Лабуда Ляля
ваафы фыфыв
LineEnd
LineBegin
Карты
LineEnd
ну то есть обрамленные в LineBegin/LineEnd. Не знаю, почему так.
######################################
# Perl script for converting Text to hex symbols.
# For usage in Shake w/ Rus. code tabel.
#-------------------
# ver 1.0 07.31.01
# Kharitonov Konstantin
# khar_khar@mail.ru
######################################
#! c:/perl/bin/perl.exe
sub begin {
return (/^(\s+|)$_[0]/);
}
sub char2hex{
use POSIX;
$number = $_[0];
$n_1="";
$n_2="";
$i_n_1=POSIX::floor($number/16);
if ($i_n_1 < 10) {
$n_1=pack("a*",$i_n_1);
}else {
if ($i_n_1 == 10) {$n_1="A";}
if ($i_n_1 == 11) {$n_1="B";}
if ($i_n_1 == 12) {$n_1="C";}
if ($i_n_1 == 13) {$n_1="D";}
if ($i_n_1 == 14) {$n_1="E";}
if ($i_n_1 == 15) {$n_1="F";}
}
$i_n_2=$number - $i_n_1*16;
if ($i_n_2 < 10) {
$n_2=pack("a*",$i_n_2);
}else {
if ($i_n_2 == 10) {$n_2="A";}
if ($i_n_2 == 11) {$n_2="B";}
if ($i_n_2 == 12) {$n_2="C";}
if ($i_n_2 == 13) {$n_2="D";}
if ($i_n_2 == 14) {$n_2="E";}
if ($i_n_2 == 15) {$n_2="F";}
}
return $n_1.$n_2;
}
# From arguments
$inputfile = $ARGV[0];
$outputfile = $ARGV[1];
if ( ($ARGV[0] eq "-h") || ($ARGV[0] eq "-help") || (@ARGV == 0)) {
print "Usage
erl text2hex.pl <input text file> <output text file>
ex.
----
perl -S convert.pl test.txt testOut.txt
----
" ;
} else {
# Default arguments
if ( !defined($inputfile) ) {$inputfile = "input.txt"; }
if ( !defined($outputfile) ) {$outputfile = "output.txt"; }
open (ORIGINAL,$inputfile) || die "Can't open input file $inputfile:$!";
open (MY,">$outputfile") || die "Can't open output file $outputfile:$!";
MAIN: while (<ORIGINAL>) {
if ( begin(LineBegin)) {
$lineout="";
print MY $_;
while (<ORIGINAL>) {
if (begin(LineEnd) ) {
comp;
print MY ($lineout."\n");
print MY $_."\n";
next MAIN;
}
comp;
chop;
$line=$_;
print MY ($line."\n");
@char = split("",$line);
foreach $char (@char){
$lineout.="\\x".char2hex(ord($char));
}
$lineout.="\\n";
}
}
}
close (ORIGINAL) || die "Can't close file $inputfile:$!";
close (MY) || die "Can't close file $outputfile:$!";
}