Menu

#5 to_marc8 drops spaces

None
wont-fix
nobody
None
5
2013-02-09
2005-02-23
No

The MARC::Charset function to_marc8 drops all space
characters. This happens because of the way the
_unpack function is implemented. It uses pack/unpack
format "A" which removes trailing spaces. But if the
packed string starts with three spaces, all three
spaces are removed.

Here is one possible way to fix the problem:
sub _unpack {
my $x = shift;
return( undef ) if ! defined( $x );
# removed: return ( unpack( 'A3A1A1', $x ) );
# added:
my ($s1, $s2, $s3) = unpack( 'A3A1A1', $x );
$s1 =~ s/^$/ /;
return ($s1, $s2, $s3);
}

Discussion

  • Galen Charlton

    Galen Charlton - 2013-02-09
    • status: open --> wont-fix
    • milestone: -->
     
  • Galen Charlton

    Galen Charlton - 2013-02-09

    Cleaning up old bugs; this one became moot with commit a607c5ae that overhauled MARC::Charset.

     

Log in to post a comment.