in reply to HTML::Entities encode_entities for perlmonks [ ]
Update: Do two runs of encode entities to encode normal characters first time and your special characters the second time. This may be a little slower than doing one pass but means you don't have to specify exactly what else you need to encode.
my $string = '[I haz square brackets]'; my $unsafe_chars = '[]'; # first pass encodes default set my $pass1= encode_entities( $string ); # second pass encodes speshul chars my $encoded = encode_entities( $pass1, $unsafe_chars );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTML::Entities encode_entities for perlmonks [ ]
by Anonymous Monk on Jun 15, 2013 at 09:03 UTC | |
by space_monk (Chaplain) on Jun 15, 2013 at 13:13 UTC | |
by trizen (Hermit) on Jun 15, 2013 at 10:10 UTC | |
by Anonymous Monk on Jun 15, 2013 at 10:46 UTC |