Try the URI::Escape module.
In reply to Re: Best way to generate URLs in CGI script? by rrwo in thread Best way to generate URLs in CGI script? by bikeNomad