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