Changeset 41

Show
Ignore:
Timestamp:
03/01/01 23:31:57
Author:
miyagawa
Message:

applied the patch from Philip.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Convert-RACE/trunk/Changes

    r38 r41  
    11Revision history for Perl extension Convert::RACE. 
     2 
     30.03  Thu Mar  1 23:03:06 JST 2001 
     4        - fixed the bug that if a character has a low byte of 0x0a,  
     5          it is ignored. 
     6          Thanks to Philip Newton <philip.newton@datenrevision.de> 
    27 
    380.02  Wed Feb 28 02:52:49 JST 2001 
  • Convert-RACE/trunk/README

    r40 r41  
    8989    Convert::Base32 manpage. 
    9090 
     91Revision history for Perl extension Convert::RACE. 
     92 
     930.03  Thu Mar  1 23:03:06 JST 2001 
     94        - fixed the bug that if a character has a low byte of 0x0a,  
     95          it is ignored. 
     96          Thanks to Philip Newton <philip.newton@datenrevision.de> 
     97 
     980.02  Wed Feb 28 02:52:49 JST 2001 
     99        - fixed the bug in case of all of the upper octets are  
     100          either 0x00 or one single other value. 
     101          Thanks to Eugen SAVIN <seugen@serifu.com> 
     102 
     1030.01  Sat Dec  9 21:01:11 2000 
     104        - original version; created by h2xs 1.19 
     105 
  • Convert-RACE/trunk/lib/Convert/RACE.pm

    r38 r41  
    99    @EXPORT = qw(to_race from_race); 
    1010     
    11     $VERSION = '0.02'; 
     11    $VERSION = '0.03'; 
    1212} 
    1313 
     
    8686    my $res = $u1; 
    8787 
    88     while ($str =~ m/(.)(.)/g) { 
     88    while ($str =~ m/(.)(.)/gs) { 
    8989        my ($u2, $n1) = ($1, $2); 
    9090        if ($u2 eq "\x00" and $n1 eq "\x99") { 
     
    169169    my $str = shift; 
    170170 
    171     my @unique_upper_octet; 
    172171    my %seen; 
    173     while ($str =~ m/(.)./g) { 
    174         push @unique_upper_octet, $1 unless $seen{$1}++; 
    175     } 
    176     return @unique_upper_octet
     172    while ($str =~ m/(.)./gs) { 
     173        $seen{$1}++; 
     174    } 
     175    return keys %seen
    177176} 
    178177 
    179178sub _include_disallowed_names($) { 
    180179    # RFC 1035: letter, digit, hyphen 
    181     return $_[0] !~ /^(?:\x00[\x30-\x7a\x2d])*$/; 
     180    return $_[0] !~ /^(?:\x00[\x30-\x39\x41-\x5a\x61-\x7a\x2d])*$/; 
    182181} 
    183182 
  • Convert-RACE/trunk/t/02race.t

    r37 r41  
    11use strict; 
    22use Test; 
    3 BEGIN { plan tests => 8
     3BEGIN { plan tests => 16
    44 
    55use Convert::RACE qw(to_race from_race); 
    66 
    7 my $i1 = "\x01\x2D\x01\x11\x01\x4B"; 
    8 my $i2 = "\x01\x2D\x00\xe0\x01\x4B"; 
    9 my $i3 = "\x01\x2D\x00\x20\x24\xd3"; 
    10 my $i4 = "\x00\x64\x01\x7e\x01\xff"; 
     7my(@utf16, @race); 
    118 
    12 my $r1 = 'bq--aewrcsy'; 
    13 my $r2 = 'bq--aew77ycl'; 
    14 my $r3 = 'bq--3aas2abaetjq'; 
    15 my $r4 = 'bq--ah7wi7x7te'; 
     9push @utf16, "\x01\x2D\x01\x11\x01\x4B"; 
     10push @utf16, "\x01\x2D\x00\xe0\x01\x4B"; 
     11push @utf16, "\x01\x2D\x00\x20\x24\xd3"; 
     12push @utf16, "\x00\x64\x01\x7e\x01\xff"; 
     13# Test \x0A as low byte with \x00 as high byte 
     14push @utf16, "\x00\x41\x00\x0A\x00\x62"; # "A\nb" 
     15# Test \x0A as low byte with something als as high byte 
     16push @utf16, "\x04\x22\x04\x10\x04\x0A\x04\x10"; # "TANYA" in Serbian 
     17# Test \x0A as high byte 
     18push @utf16, "\x0A\x2F\x0A\x41\x0A\x28\x0A\x3F"; # Gurmukhi "yuni"? 
     19# Test \x0A as both high and low byte 
     20push @utf16, "\x0A\x15\x0A\x0A\x0A\x24"; # Gurmukhi "kauuta"? 
    1621 
    17 ok(to_race($i1),$r1); 
    18 ok(to_race($i2),$r2); 
    19 ok(to_race($i3),$r3); 
    20 ok(to_race($i4),$r4); 
     22push @race, 'bq--aewrcsy'; 
     23push @race, 'bq--aew77ycl'; 
     24push @race, 'bq--3aas2abaetjq'; 
     25push @race, 'bq--ah7wi7x7te'; 
     26push @race, 'bq--abaquyq'; 
     27push @race, 'bq--aqrbacqq'; 
     28push @race, 'bq--bixuckb7'; 
     29push @race, 'bq--bikquja'; 
    2130 
    22 ok(from_race($r1),$i1); 
    23 ok(from_race($r2),$i2); 
    24 ok(from_race($r3),$i3); 
    25 ok(from_race($r4),$i4); 
     31for my $i (0..$#utf16) { 
     32    ok(to_race($utf16[$i]), $race[$i]); 
     33    ok(from_race($race[$i]), $utf16[$i]); 
     34