From e3c6f613b0f050af69403c6c2ac78fe50e59801f Mon Sep 17 00:00:00 2001 From: gustavf Date: Thu, 14 Sep 2000 12:57:50 +0000 Subject: [PATCH] Added a small script to help when creating charsets code. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@742 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- doc/translating.txt | 3 +++ po/charsetconvert.pl | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 po/charsetconvert.pl diff --git a/doc/translating.txt b/doc/translating.txt index cdb4debb..dee35a30 100644 --- a/doc/translating.txt +++ b/doc/translating.txt @@ -32,6 +32,9 @@ c) To translate the actual strings fill inn the msgstr after each d) Add the language name and language code to the array at the top of squirrelmail/functions/i18n.php. +There is also a small script in the po/ directory that can help in +creating charset mappings from the mappings files that are provided by +the Unicode consortium. 2. Maintaining translations --------------------------- diff --git a/po/charsetconvert.pl b/po/charsetconvert.pl new file mode 100755 index 00000000..7443b6dd --- /dev/null +++ b/po/charsetconvert.pl @@ -0,0 +1,29 @@ +#! /usr/bin/perl + +# This script takes an Unicode character map as input and outputs +# conversion code for SquirrelMail charset support. + +# This code is placed in the Public Domain. Written by Gustav Foseid, +# gustavf@squirrelmail.org + +$min = 160; + +while (<>) { + chop; + + unless (/^\#/) { + + ($orig_text, $unicode_text, $dummy, $name) = split /\t/; + + # oct does not only do what it's name suggest. If a string starts + # with 0x it is interpreted as a hexadecimal value. + $orig = oct $orig_text; + $unicode = oct $unicode_text; + + if ($orig >= $min) { + print " # $name\n"; + printf (' $string = str_replace("\%o", "&#%d"), $string);'."\n", + $orig, $unicode); + } + } +} -- 2.25.1