Skip to content

Instantly share code, notes, and snippets.

@MaximeD
Created January 23, 2012 18:18
Show Gist options
  • Save MaximeD/1664630 to your computer and use it in GitHub Desktop.
Save MaximeD/1664630 to your computer and use it in GitHub Desktop.
encoding testing
#!/usr/bin/env perl
use warnings;
use strict;
use utf8;
# Try with and without the folowing
binmode(STDOUT, ":utf8");
use Cwd;
chdir $ARGV[0];
print cwd() . "\n";
print "Des caractères accentués !\n";
@MaximeD
Copy link
Author

MaximeD commented Jan 23, 2012

uncommented

./encoding_test.pl ~/Téléchargements
/home/max/Téléchargements
Des caractères accentués !

commented

encoding_test.pl ~/Téléchargements
/home/max/Téléchargements
Des caract�res accentu�s !

@oelmekki
Copy link

uncommented

kik@central ~/tmp/flash $ ./test.pl
Use of uninitialized value $ARGV[0] in chdir at ./test.pl line 9.
Use of chdir('') or chdir(undef) as chdir() is deprecated at ./test.pl line 9.
/home/kik
Des caractères accentués !

commented

kik@central ~/tmp/flash $ perl test.pl
Use of uninitialized value $ARGV[0] in chdir at test.pl line 9.
Use of chdir('') or chdir(undef) as chdir() is deprecated at test.pl line 9.
/home/kik
Des caractères accentués !

@oelmekki
Copy link

ah euh, faut ptet que j'utilise un nom de dossier avec caractère non ascii :P

@oelmekki
Copy link

(j'ai viré le chdir(), je vois pas bienc e qu'il foutait là)

uncommented

kik@central ~/tmp/flash/éàù $ ./test.pl
/home/kik/tmp/flash/éàù
Des caractères accentués !

commented

kik@central ~/tmp/flash/éàù $ ./test.pl
/home/kik/tmp/flash/éàù
Des caractères accentués !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment