ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-porters
perl-win32-porters
Porting Perl 5.6 to Perl 5.8 need \P{print}
by Frank Merrow other posts by this author
Apr 5 2007 2:06PM messages near this date
view in the new Beta List Site
RE: strange problem with newSVpvn | Re: Porting Perl 5.6 to Perl 5.8 need \P{print}
So I have some existing Perl 5.6 code that I am trying to port to Perl 5.8.

Actually, "port" is the wrong word, I'd like it to be "compatible" 
with both so the same code based works under both versions of Perl.

At a certain point in the program I have a variable that is "mostly 
ASCII", but occasionally contains binary trash.  Not UTF-16 or 
some  other alphabet . . . actual binary random garbage.

Under Perl 5.6 we did the following to suppress out "the bad stuff" 
and make the message printable:

    $errmsgbase =~ tr/[\200-\377]/./; # Kill UFT-8 Problem Characters
    $errmsgbase =~ s/\P{print}/./g;   # Doctor Unprintable Characters

However, under Perl 5.8 print.pm doesn't seem to exist any 
more.  I've read the page on perlunicode, but I cannot say I 
understand it.  It mentions new character classes, but nothing that 
seems similar to "print" that I can tell.

I am not wed to this way of doing things.

Given a string containing random binary garbage, does anyone have a 
way to stamp out the non-printable characters?

It needs to work under both Perl 5.6 and Perl 5.8.

Frank

_______________________________________________
Perl-Win32-Porters mailing list
Perl-Win32-Porters@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Frank Merrow
Sisyphus
Frank Merrow
Frank Merrow

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved