in reply to Re: HTML::Entities - encode all non-alphanumeric and foreign chars?
in thread HTML::Entities - encode all non-alphanumeric and foreign chars?
The first two
wouldn't work for me. But I tried$encoded = encode_entities($input, '\W'); $encoded = encode_entities($input, '^\w');
and that did work, with one little picky issue - it was encoding every whiteepsace char as well whic, while not technically bothersome, is just not needed.$encoded = encode_entities($input, '\\W'); # note double backslash
So I tried the last formulation witha space added to list - had to add it as a simple typed space - wouldn't accept a \s:
and that does it perfectly.$encoded = encode_entities($input, '^a-zA-Z0-9_ ');
Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: HTML::Entities - encode all non-alphanumeric and foreign chars?
by Sidhekin (Priest) on Sep 23, 2007 at 20:15 UTC | |
by punch_card_don (Curate) on Sep 23, 2007 at 20:33 UTC |