You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by allan <la...@inet.uni2.dk> on 2002/10/22 21:49:00 UTC

special characters -> html entities

hi

i have some troubles with scandinavian characters in form input
fields. i wish to translate (or subsitute rather) the special ones
into their html enitity before they are put in a database.

something like:
... 
my %params = $r->method eq 'POST' ? $r->content : $r->args;

my $name = $params{$name};
$name =~ s/SPEC_CHAR/HTML_ENTITY/g;

...


but that doesn't work (?)

(the above subsitution does work with normal characters)

has this something to do with the particular perl i have build or
mod_perl or apache ?
is their an easy fix ?

perl 5.8.0 / os x darwin
mod_perl 1.27
apache 1.3.26


thanks 
./allan

Re: special characters -> html entities

Posted by Arshavir Grigorian <ag...@ejpress.com>.
Have you tried using the HTML::Entities module?

Good luck. 
Arsh 


On Tue, 22 Oct 2002 21:49:00 +0200
allan <la...@inet.uni2.dk> wrote:

> hi
> 
> i have some troubles with scandinavian characters in form input
> fields. i wish to translate (or subsitute rather) the special ones
> into their html enitity before they are put in a database.
> 
> something like:
> ... 
> my %params = $r->method eq 'POST' ? $r->content : $r->args;
> 
> my $name = $params{$name};
> $name =~ s/SPEC_CHAR/HTML_ENTITY/g;
> 
> ...
> 
> 
> but that doesn't work (?)
> 
> (the above subsitution does work with normal characters)
> 
> has this something to do with the particular perl i have build or
> mod_perl or apache ?
> is their an easy fix ?
> 
> perl 5.8.0 / os x darwin
> mod_perl 1.27
> apache 1.3.26
> 
> 
> thanks 
> ./allan