Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problem with charset

Reply
Thread Tools

problem with charset

 
 
Daneel Yaitskov
Guest
Posts: n/a
 
      07-27-2008
Hi,


I started to learn CGI and wrote his first script. I have a problem with
charset of webpage. Referenceing to man help I wrote following code:
#!/usr/bin/perl -w
use utf8;
use encoding 'utf8';
use CGI qw(:standard);

print header(-type=>'text/html', -charset=>'UTF-8');
print start_html('Simple example'),
h1('Simple example'), end_html();

The problem is that a browser gets the generated webpage with a wrong
charset. What do I make wrong?

header of webpage is:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Remote terminal</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
......

I have sent this letter here, because my letters don't come to
perl.beginners.cgi. Does anyone know why so?

Daneel
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      07-27-2008
Daneel Yaitskov wrote:
> I started to learn CGI and wrote his first script. I have a problem with
> charset of webpage. Referenceing to man help I wrote following code:
> #!/usr/bin/perl -w
> use utf8;
> use encoding 'utf8';
> use CGI qw(:standard);
>
> print header(-type=>'text/html', -charset=>'UTF-8');
> print start_html('Simple example'),
> h1('Simple example'), end_html();
>
> The problem is that a browser gets the generated webpage with a wrong
> charset. What do I make wrong?
>
> header of webpage is:
> <!DOCTYPE html
> PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
> <head>
> <title>Remote terminal</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> </head>


I'm not able to reproduce that behavior. However, the meta charset can
be set explicitly with the -encoding argument.

print start_html(
-title => 'Simple example',
-encoding => 'utf8',
), ...

> I have sent this letter here, because my letters don't come to
> perl.beginners.cgi. Does anyone know why so?


Have you subscribed to the beginners-cgi list?

http://lists.cpan.org/showlist.cgi?name=beginners-cgi

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
Daneel Yaitskov
Guest
Posts: n/a
 
      07-29-2008
Hi,


I have sloved the problem!. The cause was in that that I had used the
old CGI package. All fixed up when I had installed 3.25 version of the.

Daneel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript charset <> page charset optimistx Javascript 2 08-15-2008 12:42 PM
Problem with Java XML charset Erik A. Brandstadmoen Java 0 12-28-2004 07:10 AM
Tomcat 5 charset problem Leonidas Java 0 09-20-2004 12:30 PM
Problem with default Charset Encoding Servlet (Windows vs. RedHat) J.P.Jarolim Java 0 02-27-2004 04:11 PM
Tomcat 4.1 and Content-Type: charset header problem. Son KwonNam Java 0 02-04-2004 05:04 AM



Advertisments