[Ossm-members] Re: conversion scripts

Georgi Stanojevski georgis at unet.com.mk
Wed Jun 16 21:12:41 UTC 2004


На 16 јун 2004 (среда), linuxlists at float.lefant.net напиша:

> good2bad is tested and works without conversion faults
> bad2good is not so maybe i made some typos
> 
> if anybody has some constructive criticism i'd be happy, since i'm doing
> that php scripting for 2 weeks now.

Florian, i attached two files the first(convbad2good.php) is a php script
it translatets the YUSCII ("Makedonski Tajms") font in to windows-1251
encoding.

If you want to output something else (iso-8859-5, utf-8) first convert the
file with iconv 
(iconv -f windows-1251 -t utf-8 convbad2good.php > bad2utf.php)
and change 'charset=windows-1251"' in 'charset=utf-8"' in the html output.


The second one is a a bash shell script which uses 'tr' to convert from 
yuscii to windows-1251 code page. To output something else just iconv the
file.

-- 
Glisha
The perfect OS, MS-DOS! 
No patches, no root exploits for 21 years.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yuscii2mak.sh
Type: application/x-sh
Size: 473 bytes
Desc: not available
URL: <http://lists.softver.org.mk/pipermail/ossm-members/attachments/20040616/b5e9602b/attachment.sh>
-------------- next part --------------
<?
if ($_POST['text'] <> '') {

$text=$_POST['text'];
$text_orig=$text;

$text = str_replace('a','р',$text); $text = str_replace('A','Р',$text);
$text = str_replace('b','с',$text); $text = str_replace('B','С',$text);
$text = str_replace('v','т',$text); $text = str_replace('V','Т',$text);
$text = str_replace('g','у',$text); $text = str_replace('G','У',$text);
$text = str_replace('d','ф',$text); $text = str_replace('D','Ф',$text);
$text = str_replace('|','ƒ',$text); $text = str_replace('\\\\','',$text);
$text = str_replace('e','х',$text); $text = str_replace('E','Х',$text);
$text = str_replace('`','ц',$text); $text = str_replace('@','Ц',$text);
$text = str_replace('z','ч',$text); $text = str_replace('Z','Ч',$text);
$text = str_replace('y','О',$text); $text = str_replace('Y','Н',$text);
$text = str_replace('i','ш',$text); $text = str_replace('I','Ш',$text);
$text = str_replace('j','М',$text); $text = str_replace('J','Ѓ',$text);
$text = str_replace('k','ъ',$text); $text = str_replace('K','Ъ',$text);
$text = str_replace('l','ы',$text); $text = str_replace('L','Ы',$text);
$text = str_replace('q','š',$text); $text = str_replace('Q','Š',$text);
$text = str_replace('m','ь',$text); $text = str_replace('M','Ь',$text);
$text = str_replace('n','э',$text); $text = str_replace('N','Э',$text);
$text = str_replace('w','œ',$text); $text = str_replace('W','Œ',$text);
$text = str_replace('o','ю',$text); $text = str_replace('O','Ю',$text);
$text = str_replace('p','я',$text); $text = str_replace('P','Я',$text);
$text = str_replace('r','№',$text); $text = str_replace('R','а',$text);
$text = str_replace('s','ё',$text); $text = str_replace('S','б',$text);
$text = str_replace('t','ђ',$text); $text = str_replace('T','в',$text);
$text = str_replace('}','',$text); $text = str_replace(']','',$text);
$text = str_replace('u','ѓ',$text); $text = str_replace('U','г',$text);
$text = str_replace('f','є',$text); $text = str_replace('F','д',$text);
$text = str_replace('h','ѕ',$text); $text = str_replace('H','е',$text);
$text = str_replace('c','і',$text); $text = str_replace('C','ж',$text);
$text = str_replace('~','ї',$text); $text = str_replace('^','з',$text);
$text = str_replace('x','Ÿ',$text); $text = str_replace('X','',$text);
$text = str_replace('{','ј',$text); $text = str_replace('[','и',$text);

echo 'Original text:<BR>';
echo '<pre>';
echo $text_orig;
echo '</pre>';
echo 'Converted text:<BR>';
echo '<pre>';
echo $text;
echo '</pre>';

} else {

?>
<html>
<head>
<title>Conversion</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"
</head>
<body>
<FORM method="post" action="<? echo $PHP_SELF ?>">
<TEXTAREA name="text" COLS="66" ROWS="29">
</TEXTAREA><BR>
<INPUT type="submit" value="Convert">
</FORM>
</body>

<?

}


More information about the Ossm-members mailing list