oylee has asked for the wisdom of the Perl Monks concerning the following question:
When I slurp in an HTML file containing Chinese characters and spit it back out using something like#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); my $q = new CGI(); my $charset = "gb2312"; print $q->header(-type => 'text/html', -charset => $charset ); print q(<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> ); print q(<head><title>Stuff</title>); print qq(<meta http-equiv="Content-Type" content="text/html; charset=$ +charset">); print "what be this?", "\272"; print "\n\n<p>What the humma humma is this now :", 0x0272, ":</p>\n\n" +; print $q->end_html(); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing Chinese characters with CGI.pm
by sauoq (Abbot) on Jul 23, 2002 at 19:39 UTC |