The Samba-Bugzilla – Attachment 2860 Details for
Bug 3997
support encodings other than ISO-8859-1 on command-line
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated patch (Do not require any UTF-8 converter module if $config{encoding}=~/^UTF-?8$/i)
smbldap-tools-0.9.2.utf8.patch (text/plain), 2.71 KB, created by
SATOH Fumiyasu
on 2007-08-10 01:48:59 UTC
(
hide
)
Description:
Updated patch (Do not require any UTF-8 converter module if $config{encoding}=~/^UTF-?8$/i)
Filename:
MIME Type:
Creator:
SATOH Fumiyasu
Created:
2007-08-10 01:48:59 UTC
Size:
2.71 KB
patch
obsolete
>diff -urp 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.000000000 +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 -urp 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 2007-08-10 11:22:54.487529591 +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,9 @@ if (!defined $config{slavePort}) { > if (!defined $config{ldapTLS}) { > $config{ldapTLS}="0"; > } >+if (!defined $config{encoding}) { >+ $config{encoding}="UTF-8"; >+} > > sub connect_ldap_master > { >@@ -1070,23 +1071,42 @@ sub get_next_id($$) { > die "Could not allocate $attribute!"; > } > >-sub utf8Encode { >- my $arg = shift; >- >- return to_utf8( >- -string=> $arg, >- -charset => 'ISO-8859-1', >- ); >+if ($config{encoding} =~ /^UTF-?8$/i) { >+ *utf8Encode = *utf8Decode = sub { return shift; }; >+} >+elsif (eval q{ use Text::Iconv; 1; }) { >+ my $to_utf8_iconv = Text::Iconv->new($config{encoding}, 'UTF-8'); >+ *utf8Encode = sub { >+ return $to_utf8_iconv->convert(shift); >+ }; >+ my $from_utf8_iconv = Text::Iconv->new('UTF-8', $config{encoding}); >+ *utf8Decode = sub { >+ return $from_utf8_iconv->convert(shift); >+ }; >+} >+elsif (eval q{ use Encode; 1; }) { >+ *utf8Encode = sub { >+ my $string = shift; >+ Encode::from_to($string, $config{encoding}, 'UTF-8', eval q{Encode::FB_CROAK}); >+ return $string; >+ }; >+ *utf8Decode = sub { >+ my $string = shift; >+ Encode::from_to($string, 'UTF-8', $config{encoding}, eval q{Encode::FB_CROAK}); >+ return $string; >+ }; >+} >+elsif (eval q{ use Unicode::MapUTF8; 1; }) { >+ *utf8Encode = sub { >+ return Unicode::MapUTF8::to_utf8({ -string => shift, -charset => $config{encoding} }); >+ }; >+ *utf8Decode = sub { >+ return Unicode::MapUTF8::from_utf8({ -string => shift, -charset => $config{encoding} }); >+ }; >+} >+else { >+ die "No UTF-8 converter found!\n"; > } >- >-sub utf8Decode { >- my $arg = shift; >- >- return from_utf8( >- -string=> $arg, >- -charset => 'ISO-8859-1', >- ); >-} > > 1; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3997
:
2082
| 2860