diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2009-07-04 16:42:30 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2009-07-04 16:42:30 +0000 |
| commit | d5edcef1df9356b37e7a19c6d0f401298df9c3d5 (patch) | |
| tree | 056ccac5bb4b8cab50a90b13d8a7059d258d7363 /bin | |
| parent | d214d07a627df39a9ab47264fa4e58b87f9f3893 (diff) | |
| download | xxv-d5edcef1df9356b37e7a19c6d0f401298df9c3d5.tar.gz xxv-d5edcef1df9356b37e7a19c6d0f401298df9c3d5.tar.bz2 | |
* add automated detect for environment with UTF-8 ('export LANG=de_DE.utf8; xxvd'), remove xxvd option --utf8
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/xxvd | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -92,7 +92,6 @@ GetOptions ( "newstmpl=s" => \$PATHS->{NEWSTMPL}, "xmltv=s" => \$PATHS->{XMLTV}, "verbose=s" => \$verbose, # debug output level - "utf8" => \$useutf8, # Use encoding utf8 as data charset. "version" => \$version, # print version "nofork" => \$nofork, # switch fork off, for better debugging "kill" => \$killer, # kill old xxvd @@ -137,7 +136,7 @@ unless($nofork) { } } -setlocale (LC_ALL, ''); #From environment like 'export LANG="fr_FR"' +my $current_locale = setlocale (LC_ALL, ''); #From environment like 'export LANG="fr_FR"' # Load a config my $CFGOBJ = Config::Tiny->new(); @@ -148,6 +147,10 @@ unless($Config){ exit(1); } +# Check for environment with UTF-8 +$useutf8 = 1 if($current_locale && + ($current_locale =~ /UTF.+8/sig + || $current_locale =~ /utf8/sig)); # Install i18n system $charset = &init_locale($Config, $PATHS, $useutf8); @@ -162,6 +165,8 @@ if($cfgUsrFile ne $cfgFile) { debug sprintf('Use configuration file "%s"', $cfgUsrFile); } +debug sprintf("Used database charset '%s'", $charset); + # Check templateModul &init_template($TEMPLMOD); @@ -487,8 +492,6 @@ sub init_locale { my $useutf8 = shift; my $charset; - # use I18N::Langinfo qw(langinfo CODESET); - # $charset = langinfo(CODESET); if($useutf8){ $charset = 'UTF-8'; eval 'use utf8'; |
