Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to specify Encode:: <subchar>?

by ikegami (Patriarch)
on Mar 18, 2008 at 12:49 UTC ( [id://674774]=note: print w/replies, xml ) Need Help??


in reply to How to specify Encode:: <subchar>?

How about
use constant FB_SPACE => sub { ' ' }; $bytes = encode($charset, $chars, FB_SPACE);

Update: Tested:

use Encode qw( encode FB_DEFAULT ); use HTML::Entities qw( decode_entities ); use constant FB_SPACE => sub { ' ' }; my $chars = decode_entities('abc&hearts;def'); my $charset = 'US-ASCII'; for my $check (FB_DEFAULT, FB_SPACE) { print encode($charset, $chars, $check), "\n"; }
abc?def abc def

Replies are listed 'Best First'.
Re^2: How to specify Encode:: <subchar>?
by Marcello (Hermit) on Mar 19, 2008 at 09:58 UTC
    Thanks ++ikegami,

    Upgraded my Encode version from 2.01 to the latest 2.24 and using this new functionality.

    Regards, Marcel

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://674774]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found