From 51abe1d11a02f6854cf9917b4d6c32965c6e7be6 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 17 Feb 2017 13:19:17 +0100 Subject: [PATCH] Get default encoding from locale --- charhist/charhist.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/charhist/charhist.pl b/charhist/charhist.pl index 8460480..0cdcf58 100644 --- a/charhist/charhist.pl +++ b/charhist/charhist.pl @@ -1,11 +1,13 @@ #!/usr/bin/perl use warnings; use strict; -use Getopt::Long; -use Pod::Usage; use autodie; -my $encoding; +use Getopt::Long; +use I18N::Langinfo qw(langinfo CODESET); +use Pod::Usage; + +my $encoding = langinfo(CODESET); GetOptions('encoding=s', \$encoding) or pod2usage();