Skip Menu |
 

This queue is for tickets about the Text-Tabs+Wrap CPAN distribution.

Report information
The Basics
Id: 95823
Status: new
Priority: 0/
Queue: Text-Tabs+Wrap

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2013.0523
Fixed in: (no value)



Subject: Default $break statement should not include 0xA0 ( Nonbreaking space ) or 0x202f ( Narrow no-break space )
perl -E' say q[match] if chr(0xA0) =~ /^\s$/ '
Show quoted text
# match

http://en.wikipedia.org/wiki/Non-breaking_space

Accoding to perldoc perlrecharclass, \s matches very many things which may not be considered "breakable spaces" in unicode strings, importantly:

 0x00a0              NO-BREAK SPACE   h s
 0x202f       NARROW NO-BREAK SPACE   h s

Attached is an example which generates a UTF8 string with no-break space in it, showing how it presently wraps, with a proposed replacement default regex ( moritz++ ) that excludes those 2 characters from being breaking characters.
Subject: wrap.pl
Download wrap.pl
text/x-perl 483b
#!/usr/bin/env perl # ABSTRACT: Wrap text use strict; use warnings; use utf8; use Text::Wrap; my $sample = join chr(0xA0) , qw( this is a statement that should not wrap ever ); utf8::upgrade($sample); my $string = join q[ ], ( $sample ) x 20; if ( $sample =~ /\s/ ) { print "Sample contains space!\n"; } print "\n"; print wrap(" - ", " >", $string ); print "\n"; $Text::Wrap::break='(?![\x{00a0}\x{202f}])\s'; print "\n"; print wrap(" - ", " >", $string ); print "\n";


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.