Sunday, June 6, 2004 Idris Samawi Hamid wrote:

> Hi Giuseppe (Is it not way past your bedtime;->),

Yes it is, and it shows. But since I'm up and not having any
particular urge to go to bed in this very moment, here's a
tested alternative that works here:

==
#!/usr/bin/perl

use strict;
use warnings;

open(NEW,">new.tex"); #opens file to print out the result

while (<>) { #this opens the file for reading

$_ =~ s/\xD8\xA7/A/g; #this is the actual conversion
$_ =~ s/\xD8\xA8/b/g; #this is the actual conversion
$_ =~ s/\xD8\xAC/j/g; #this is the actual conversion
$_ =~ s/\xD8\xAF/d/g; #this is the actual conversion
$_ =~ s/\xD9\x87/h/g; #this is the actual conversion
$_ =~ s/\xD9\x88/w/g; #this is the actual conversion
$_ =~ s/\xD8\xB2/z/g; #this is the actual conversion

print NEW "$_"; #and this writes the result into file "new.tex"
}

close(NEW);
===

to be used as

utf2tex filename

If you want to add more conversions, open your unicode file in
an hex editor and check the actual byte-per-byte hex value of
the utf text for the other characters you want to add. This
should be enough for your needs.

-- 
Giuseppe "Oblomov" Bilotta

_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to