we need to unset LANG if we don't want to corrupt encoding
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 16 Mar 2009 13:34:32 +0000 (13:34 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 16 Mar 2009 13:34:32 +0000 (13:34 +0000)
bin/ldap-rewrite.pl

index 4e2d55e..23e790b 100755 (executable)
@@ -131,10 +131,6 @@ sub run_proxy {
        die "Could not create listener socket: $!\n" unless $listenersock;
        die "Could not create connection to server: $!\n" unless $targetsock;
 
-       # mark sockets as binary
-       binmode( $listenersock );
-       binmode( $targetsock );
-
        my $sel = IO::Select->new($listenersock);
        my %Handlers;
        while (my @ready = $sel->can_read) {
@@ -157,6 +153,8 @@ sub run_proxy {
 }
 
 
+$ENV{LANG} = 'C'; # so we don't double-encode utf-8 if LANG is utf-8
+
 my $listenersock = IO::Socket::INET->new(
        Listen => 5,
        Proto => 'tcp',