in reply to Handling HTML special characters correctly
and another way is use the META tag in your HTML output:Content-Type: text/html; charset=UTF-8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
Also, when you receive form parameters in a CGI script, you always need to decode them according to how they were encoded by the form:
Now $name will contain code-points which is probably the most useful representation for your application. From there you can convert it to any other particular encoding when you need to.use CGI qw(:standard); use Encode; ... my $name = Encode::decode('utf-8', scalar(param('name')));
This article: Character Conversions from Browser to Database does a good job of explaining the issues involved.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Handling HTML special characters correctly
by cosmicperl (Chaplain) on Jul 03, 2008 at 00:33 UTC |