summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2009-07-04 16:42:30 +0000
committerAndreas Brachold <vdr07@deltab.de>2009-07-04 16:42:30 +0000
commitd5edcef1df9356b37e7a19c6d0f401298df9c3d5 (patch)
tree056ccac5bb4b8cab50a90b13d8a7059d258d7363 /bin
parentd214d07a627df39a9ab47264fa4e58b87f9f3893 (diff)
downloadxxv-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-xbin/xxvd11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/xxvd b/bin/xxvd
index 2403533..3a8d6e9 100755
--- a/bin/xxvd
+++ b/bin/xxvd
@@ -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';