Re[2]: [NTG-context] Arabic-utf-8 (plus a sample)

Giuseppe Bilotta ntg-context@ntg.nl
Sun Jun 6 00:15:56 CEST 2004


Sunday, June 6, 2004 Idris Samawi Hamid wrote:

> Here is the whole file once again:

> ==================================
> #!/usr/bin/perl -w

> use strict;
> use open ':utf8';

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

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

> $_ =~ s/\x{0627}/\x{0041}/esg;
> #this is the actual conversion

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

> close(NEW);
> ==================================

My take: try the following (should work even with ActiveState
5.6)

===
#!/usr/bin/perl

use strict;
#D comment the following, I think we can do without
# use open ':utf8';

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

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

$_ =~ s/\x06\x27/A/esg; #this is the actual conversion

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

close(NEW);
===

Save as e.g. idris_conv.pl and issue as


perl idris_conv.pl < filename.txt

where filename.txt is the filename to convert.

-- 
Giuseppe "Oblomov" Bilotta





More information about the ntg-context mailing list