ralphch has asked for the wisdom of the Perl Monks concerning the following question:

Hi.

I have these perl cgi scripts that display html forms that are in Chinese. The character set is set to 'big5' in the html, but for some reason the Chinese characters don't display correctly. When having a flat html file (no perl) then the Chinese characters display correctly, so I believe there must be a problem with the Perl parser.

One of these forms is: http://www.forrealty.net/cgi-bin/contact-formchin.cgi

Does anyone know what I can do to make the Chinese characters display correctly?

Thanks,
Ralph.

Replies are listed 'Best First'.
Re: Chinese characters problem
by wog (Curate) on Jul 21, 2001 at 00:33 UTC
    lhoward is correct with his answer. To expand on that: if you are using the CGI module (as you should) then you can output this type of header using something like print header(-charset=>'big5'). A big reason why you need to do this is that the CGI module by default outputs charset=ISO-8859-1; this must be explictly overriden. You probably have seen that, at least with your web browser, a META tag is not enough to override it.
Re: Chinese characters problem
by lhoward (Vicar) on Jul 20, 2001 at 23:43 UTC
    My guess is that you're not setting the character set properly in the Content-Type properly in the HTTP header. Your Content-Type header should look something like this:
    Content-type: text/html; charset=big5
    
    In many cases, setting a METTA HTTP-EQUIV in the header just isn't enough.
Re: Chinese characters problem
by ralphch (Sexton) on Jul 21, 2001 at 02:17 UTC
    Hi.
    Thanks for your replies!

    It worked. As you said I had to add -charset=>'big5' to header.

    Thanks,
    Ralph :)