Unifying strings
[squirrelmail.git] / po / charsetconvert.pl
1 #! /usr/bin/perl
2
3 # This script takes an Unicode character map as input and outputs
4 # conversion code for SquirrelMail charset support.
5
6 # This code is placed in the Public Domain. Written by Gustav Foseid,
7 # gustavf@squirrelmail.org
8
9 $min = 160;
10
11 while (<>) {
12 chop;
13
14 unless (/^\#/) {
15
16 ($orig_text, $unicode_text, $dummy, $name) = split /\t/;
17
18 # oct does not only do what it's name suggest. If a string starts
19 # with 0x it is interpreted as a hexadecimal value.
20 $orig = oct $orig_text;
21 $unicode = oct $unicode_text;
22
23 if ($orig >= $min) {
24 print " // $name\n";
25 printf (' $string = str_replace("\%o", "&#%d", $string);'."\n",
26 $orig, $unicode);
27 }
28 }
29 }