1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| #!/usr/bin/perl
#
# Nouv
#
use warnings;
use strict;
use utf8;
use Encode;
#use encoding 'utf8';
use Tk;
my ( $nom_fic, $t, $Ligne, $line, @lettre, @chars, $digit, $texte, $info ) = ();
my $Wm = MainWindow->new;
$nom_fic = "./LLc_08/P_04.utf8";
# Crée les widgets nécessaires
my $cadre =$Wm->Frame->pack(
-side => 'top',
-fill => 'x');
$cadre->Button(
-text => "Fin", -command => sub { exit; }
)->pack(-side => 'right');
$cadre->Button(
-text => "Charger", -command => \&lire_fic
)->pack(-side => 'right', -anchor => 'e');
$cadre->Label(
-textvariable =>\$info,
-relief => 'ridge'
)->pack(-side => 'bottom', -fill => 'x');
$texte = $Wm->Scrolled("Text"
)->pack(-side => 'bottom', -fill => 'both', -expand => 1);
$texte->tagConfigure('gras',
-font => "{Simplified Arabic} 16 {bold}", -justify => 'right',);
MainLoop;
# Lire
sub lire_fic {
my $info = "Chargement du fichier '$nom_fic";
#my $texte->delete("1.0", "end");
open FIC, '<:encoding(UTF-8)', $nom_fic or $t->insert('end', "ERREUR : Impossible d'ouvrir $nom_fic\n"), return;
#open FIC, '<:encoding(unicode)', $nom_fic or $t->insert('end', "ERREUR : Impossible d'ouvrir $nom_fic\n"), return;
while (<FIC>) {
$line = $_ ;
$texte->insert("end", $line ,'gras');
$texte->insert("end","\n");
@lettre = split(//, $line);
foreach (@lettre) {
$texte->insert("end", $_ ,'gras');
$digit = $_;
#print "$digit \n";
#printf '<%#x>' $digit;
printf ("%lx", $digit);
}
$texte->insert("end","\n");
$texte->insert('end', "\x{FE94}\x{FEF4}\x{FE91}\x{FEAE}\x{FECC}\x{FEDF}\x{FE8D}\x{FE94}\x{FEE4}\x{FEE0}\x{FEDC}\x{FEDF}\x{FE8D}", 'gras');
$texte->insert("end","\n", 'gras');
$texte->insert('end', "\x{feff}\x{645}\x{64e}\x{627}\x{630}\x{64e}\x{627}\x{20}", 'gras');
#$texte->insert("end","\n", 'gras');
$texte->insert("end","NB sur 3 digit SECCABLES !\n", 'gras');
$texte->insert("end","\n", 'gras');
$texte->insert('end', "\x{feff}\x{6405}\x{640e}\x{6207}\x{6300}\x{640e}\x{6207}\x{20}", 'gras');
$texte->insert("end","sur 4 digit INsécables !!! ", 'gras');
$texte->insert("end","\n");
}
close (FIC);
} |
Partager