View | Details | Raw Unified | Return to bug 13075
Collapse All | Expand All

(-)a/C4/Charset.pm (+1 lines)
Lines 179-184 Sample code : Link Here
179
179
180
sub NormalizeString{
180
sub NormalizeString{
181
	my ($string,$nfd,$transform)=@_;
181
	my ($string,$nfd,$transform)=@_;
182
    return $string unless defined($string); # force scalar context return.
182
	utf8::decode($string) unless (utf8::is_utf8($string));
183
	utf8::decode($string) unless (utf8::is_utf8($string));
183
	if ($nfd){
184
	if ($nfd){
184
		$string= NFD($string);
185
		$string= NFD($string);
(-)a/t/Charset.t (-2 / +10 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 11;
20
use Test::More tests => 16;
21
use MARC::Record;
21
use MARC::Record;
22
22
23
use utf8;
23
use utf8;
Lines 27-32 BEGIN { Link Here
27
    use_ok('C4::Charset');
27
    use_ok('C4::Charset');
28
}
28
}
29
29
30
my $string;
31
ok(!defined(NormalizeString($string,undef,1)),'Uninitialized string case 1 normalizes to uninitialized string.');
32
33
$string = 'Sample';
34
ok(defined(NormalizeString($string,undef,0)), 'Initialized string case 1 normalizes to some string.');
35
ok(defined(NormalizeString($string,undef,1)), 'Initialized string case 2 normalizes to some string.');
36
ok(defined(NormalizeString($string,1,0)),     'Initialized string case 3 normalizes to some string.');
37
ok(defined(NormalizeString($string,1,1)),     'Initialized string case 4 normalizes to some string.');
38
30
my $octets = "abc";
39
my $octets = "abc";
31
ok(IsStringUTF8ish($octets), "verify octets are valid UTF-8 (ASCII)");
40
ok(IsStringUTF8ish($octets), "verify octets are valid UTF-8 (ASCII)");
32
41
33
- 

Return to bug 13075