diff -wurp smbldap-tools-0.9.2/smbldap.conf smbldap-tools-0.9.2.fumiyas/smbldap.conf
--- smbldap-tools-0.9.2/smbldap.conf	2006-01-03 19:57:41.000000000 +0900
+++ smbldap-tools-0.9.2.fumiyas/smbldap.conf	2006-04-26 20:54:37.122742736 +0900
@@ -224,3 +224,6 @@ slappasswd="/usr/sbin/slappasswd"
 # comment out the following line to get rid of the default banner
 # no_banner="1"
 
+# Character encoding on command-line
+encoding="UTF-8"
+
diff -wurp smbldap-tools-0.9.2/smbldap_tools.pm smbldap-tools-0.9.2.fumiyas/smbldap_tools.pm
--- smbldap-tools-0.9.2/smbldap_tools.pm	2006-01-03 19:57:41.000000000 +0900
+++ smbldap-tools-0.9.2.fumiyas/smbldap_tools.pm	2006-04-27 01:39:48.944806071 +0900
@@ -3,8 +3,6 @@ use strict;
 package smbldap_tools;
 use Net::LDAP;
 use Crypt::SmbHash;
-use Unicode::MapUTF8 qw(to_utf8 from_utf8);
-
 
 # $Id: smbldap_tools.pm,v 1.65 2006/01/02 17:01:19 jtournier Exp $
 #
@@ -275,6 +273,45 @@ if (!defined $config{slavePort}) {
 if (!defined $config{ldapTLS}) {
 	$config{ldapTLS}="0";
 }
+if (!defined $config{encoding}) {
+	$config{encoding}="UTF-8";
+}
+
+my $to_utf8;
+my $from_utf8;
+if (eval qq{ use Text::Iconv; 1; }) {
+    my $to_utf8_iconv = Text::Iconv->new($config{encoding}, 'UTF-8');
+    $to_utf8 = sub {
+	return $to_utf8_iconv->convert(shift);
+    };
+    my $from_utf8_iconv = Text::Iconv->new('UTF-8', $config{encoding});
+    $from_utf8 = sub {
+	return $to_utf8_iconv->convert(shift);
+    };
+}
+elsif (eval qq{ use Encode; 1; }) {
+    $to_utf8 = sub {
+	my $string = shift;
+	Encode::from_to($string, $config{encoding}, 'UTF-8', Encode::FB_CROAK);
+	return $string;
+    };
+    $from_utf8 = sub {
+	my $string = shift;
+	Encode::from_to($string, 'UTF-8', $config{encoding}, Encode::FB_CROAK);
+	return $string;
+    };
+}
+elsif (eval qq{ use Unicode::MapUTF8; 1; }) {
+    $to_utf8 = sub {
+	return Unicode::MapUTF8::to_utf8({ -string => shift, -charset => $config{encoding} });
+    };
+    $from_utf8 = sub {
+	return Unicode::MapUTF8::from_utf8({ -string => shift, -charset => $config{encoding} });
+    };
+}
+else {
+  die "No UTF-8 converter found!\n";
+}
 
 sub connect_ldap_master
   {
@@ -1073,19 +1110,15 @@ sub get_next_id($$) {
 sub utf8Encode {
   my $arg = shift; 
 
-  return to_utf8(
-                                 -string=> $arg,
-                                 -charset => 'ISO-8859-1',
-                                );
+  return $arg if ($config{encoding} =~ /^UTF-?8$/i);
+  return $to_utf8->($arg);
 }
 
 sub utf8Decode {
   my $arg = shift;
 
-  return from_utf8(
-                                   -string=> $arg,
-                                   -charset => 'ISO-8859-1',
-                                  );
+  return $arg if ($config{encoding} =~ /^UTF-?8$/i);
+  return $from_utf8->($arg);
 }   
 
 1;
