From: Idris Samawi Hamid <ishamid@colostate.edu>
Subject: Re: Perl scripting (was: Arabic-utf-8)
Date: Sun, 06 Jun 2004 15:03:24 -0600 [thread overview]
Message-ID: <opr86x3ys8u9mfh0@lamar.colostate.edu> (raw)
In-Reply-To: <3960A2BA-B799-11D8-B99E-0030659899AA@fiee.net>
On Sun, 6 Jun 2004 11:09:32 +0200, Henning Hraban Ramm <hraban@fiee.net>
wrote:
> -----
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
>
> my ($Source, $Target) = (shift, shift); # gets 2 file names from command
> line
>
> my %conv = ( # enhance as needed
> "\xD8xA7" => "A",
> "\xD8xA8" => "b",
> "\xD8xAC" => "j",
> "\xD8xAF" => "d"
> );
>
> open SOURCE, "<", $Source || die $!;
> open TARGET, ">", $Target || die $!;
> # there are ways to read a whole file in one scalar,
> # e.g. with File::Slurp, but I don't know them by heart...
> while (my $line = <SOURCE>) {
> foreach my $key (keys %conv) {
> $line =~ s/$key/$conv{$key}/g;
> } # foreach
> print TARGET $line;
> } # while
> close SOURCE;
> close TARGET;
>
> -----
Thnx; I'll play around with this as well. BTW: is there any way to do this
without the hex editor and just enter the full 4-digit character (a la
Thomas's original suggestion) e.g.,
"\x0627" => "A"
While the hex editor certainly works it is really slow and tedious work...
> BTW: ActiveState has Perl 5.8.4, at least for Windows (I use it at work).
Ok, I found it:
http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.3.809-MSWin32-x86.zip
But the web site (at first glance) sure gives one the impression that
their latest release is
5.6.1.638
http://www.activestate.com/
http://www.activestate.com/Products/ActivePerl/
Best
Idris
--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
next prev parent reply other threads:[~2004-06-06 21:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-05 19:32 Arabic-utf-8 (plus a sample) Idris Samawi Hamid
2004-06-05 20:41 ` Thomas A. Schmitz
2004-06-05 21:33 ` Idris Samawi Hamid
2004-06-05 21:48 ` Thomas A. Schmitz
2004-06-05 22:51 ` Idris Samawi Hamid
2004-06-05 23:15 ` Re[2]: " Giuseppe Bilotta
2004-06-05 23:31 ` Idris Samawi Hamid
2004-06-05 23:58 ` Re[4]: " Giuseppe Bilotta
2004-06-06 0:19 ` Idris Samawi Hamid
2004-06-06 0:26 ` Idris Samawi Hamid
2004-06-06 9:09 ` Perl scripting (was: Arabic-utf-8) Henning Hraban Ramm
2004-06-06 21:03 ` Idris Samawi Hamid [this message]
2004-06-06 21:28 ` Thomas A. Schmitz
2004-06-07 19:45 ` Henning Hraban Ramm
2004-06-07 20:53 ` Thomas A.Schmitz
2004-06-05 23:08 ` [SPAM: 3.411] Arabic-utf-8 (plus a sample) Richard MAHONEY
2004-06-06 0:19 ` Idris Samawi Hamid
2004-06-06 13:22 ` Arabic-utf-8 " George N. White III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=opr86x3ys8u9mfh0@lamar.colostate.edu \
--to=ishamid@colostate.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).