Ignore:
Timestamp:
11/09/11 06:35:05 (19 months ago)
Author:
PaulHarvey
Message:

Item11185: Fix wide char in print in logger code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Logger/PlainFile.pm

    r12668 r13027  
    44use strict; 
    55use warnings; 
     6use utf8; 
    67use Assert; 
    78 
     
    8384    my $mode = '>>'; 
    8485 
    85     # Item10764, TODO: actually, perhaps we should open the stream this way 
    86     # for any encoding, not just utf8. Babar says: check what Catalyst does. 
    87     # TODO: 'utf8' vs 'utf-8' 
    88     if ( $Foswiki::cfg{Site}{CharSet} eq 'utf-8' ) { 
    89         $mode .= ':encoding(utf8)'; 
     86    # Item10764, SMELL UNICODE: actually, perhaps we should open the stream this 
     87    # way for any encoding, not just utf8. Babar says: check what Catalyst does. 
     88    if ( $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8$/ ) { 
     89        $mode .= ":encoding($Foswiki::cfg{Site}{CharSet})"; 
    9090    } elsif ( utf8::is_utf8($message) ) { 
    9191        require Encode; 
    92         $message = Encode::encode( $Foswiki::cfg{Site}{CharSet}, $message, 0 ); 
     92        $message = Encode::encode( $Foswiki::cfg{Site}{CharSet}, $message, 0 ); 
    9393    } 
    9494    if ( open( $file, $mode, $log ) ) { 
Note: See TracChangeset for help on using the changeset viewer.