problem with charset

Discussion in 'Perl Misc' started by Daneel Yaitskov, Jul 27, 2008.

  1. 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
    Daneel Yaitskov, Jul 27, 2008
    #1
    1. Advertising

  2. 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
    Gunnar Hjalmarsson, Jul 27, 2008
    #2
    1. Advertising

  3. 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
    Daneel Yaitskov, Jul 29, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Son KwonNam
    Replies:
    0
    Views:
    1,055
    Son KwonNam
    Feb 4, 2004
  2. J.P.Jarolim
    Replies:
    0
    Views:
    1,045
    J.P.Jarolim
    Feb 27, 2004
  3. Leonidas

    Tomcat 5 charset problem

    Leonidas, Sep 20, 2004, in forum: Java
    Replies:
    0
    Views:
    663
    Leonidas
    Sep 20, 2004
  4. Erik A. Brandstadmoen

    Problem with Java XML charset

    Erik A. Brandstadmoen, Dec 28, 2004, in forum: Java
    Replies:
    0
    Views:
    988
    Erik A. Brandstadmoen
    Dec 28, 2004
  5. optimistx

    javascript charset <> page charset

    optimistx, Aug 14, 2008, in forum: Javascript
    Replies:
    2
    Views:
    254
    optimistx
    Aug 15, 2008
Loading...

Share This Page