Re: [PBML] How to convert to ascii
- From: daymobrew@...
> --- In firstname.lastname@example.org, Paul Archer <tigger@i...> wrote:And what will you do if there are some unescaped chars?
> > 10:11am, Gilles Beauregard wrote: > > > Allo! > > > > How to convert
> the following string to regular ascii: > > > >
> mailto:we > > > Look at chr
> (and it's opposite, ord). But that looks like HTML encoding (to > my
> non-web master/developer eye). So my guess is there's a subrouting in
> the > CGI module that'll do what you want. >
> There is an escapeHTML() function in CGI.pm but I didn't find a
> reversal function.
> As Paul suggests, chr() will convert 109 to 'm'
> So, maybe you could split the string on semi-colons, strip off the
> '' and then run through chr().
Use regexp replacement instead:
$string =~ s/&\#(\d+);/chr($1)/ge;
or even better, use a module:
$string = decode_entities($string);
that way you can be sure even á and ø type entities are
===== Jenda@... === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
- Is there an equivilent command in perl as the php include function
(basically includes another script as if it were a part of the script
>Use regexp replacement instead:Work great!
> $string =~ s/&\#(\d+);/chr($1)/ge;
>or even better, use a module:
> use HTML::Entities;
> $string = decode_entities($string);
Encore plus de trucs et d'astuces pour Webmasters
More Webmastering trics: