summaryrefslogtreecommitdiff
path: root/language/arabic/dad/dad-to-utf8.pl
blob: 85d971af481a55ccdf20f8ad59cce9b8c3162381 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/perl
use utf8;
binmode stdin,":utf8";
binmode stdout,":utf8";

sub encode {
my $s=shift;
my @RES=();
while ($s =~ m/(.)/g) {
$c=$1;
#if ($c =~ m/[A-Za-z]/) {
push @RES, ord($c);
#} else {
#push @RES, $c;
#}
}
return join("•",@RES);
}

sub decode {
my $s=shift;
my @S=split(/•/,$s);
my $res="";
foreach $c (@S) {
#if ($c =~ m/^[0-9]+$/) {
$res.=chr($c);
#} else { $res.=$c; }
}
return $res;
}

while (<>) {
s/\\([A-Za-z]+)/"\\".&encode($1)."§"/ge;
s/\|/ء/g;
s/'A/آ/g;
s/'a/أ/g;
s/'u/ؤ/g;
s/'i/إ/g;
s/'I/ئ/g;
s/'b/ٮ/g;
s/'n/ں/g;
s/'f/ڡ/g;
s/'q/ٯ/g;
s/s-h/سه/g;
s/t-h/ته/g;
s/z-h/زه/g;
s/d-h/ده/g;
s/A/ا/g;
s/b/ب/g;
s/t\*/ة/g;
s/c/ث/g;
s/t/ت/g;
s/j/ج/g;
s/H/ح/g;
s/x/خ/g;
s/dh/ذ/g;
s/d/د/g;
s/r/ر/g;
s/zh/ژ/g;
s/z/ز/g;
s/sh/ش/g;
s/s/س/g;
s/S/ص/g;
s/D/ض/g;
s/T/ط/g;
s/Z/ظ/g;
s/`/ع/g;
s/R/غ/g;
s/f/ف/g;
s/q/ق/g;
s/k/ك/g;
s/[Ll]/ل/g;
s/m/م/g;
s/n/ن/g;
s/h/ه/g;
s/U/و/g;
s/I/ى/g;
s/Y/ي/g;
s/p/پ/g;
s/C/چ/g;
s/v/ڤ/g;
s/g/گ/g;
s/e/ۀ/g;
s/--/ـ/g;
s/-/‍/g;
s/aN/ً/g;
s/uN/ٌ/g;
s/iN/ٍ/g;
s/a\*\*/ٓ/g;
s/a\*/ٰ/g;
s/a/َ/g;
s/u/ُ/g;
s/i/ِ/g;
s/\+/ّ/g;
s/o/ْ/g;
s/\\([0-9•]+)§/"\\".&decode($1)/ge;
print;
}