[Templates] UTF8 support and issues

Mark Proctor m.proctor@bigfoot.com
Wed, 20 Nov 2002 19:11:22 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C290C8.9D5A6080
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0014_01C290C8.9D5D6DC0"


------=_NextPart_001_0014_01C290C8.9D5D6DC0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

For those also having the issue - here is a working example. I've placed
in some unicode in as default in the textarea if no parameters are
supplied - so all you have to do is press submit to see the concatenated
results.
 
Mark

------=_NextPart_001_0014_01C290C8.9D5D6DC0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D264152611-20112002><SPAN=20
class=3D767040619-20112002>For those also having the issue - here is a =
working=20
example. I've placed in some unicode in as default in the textarea if no =

parameters are supplied - so all you have to do is press submit to see =
the=20
concatenated results.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D264152611-20112002><SPAN=20
class=3D767040619-20112002></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D264152611-20112002><SPAN=20
class=3D767040619-20112002>Mark</SPAN></SPAN></FONT></DIV></BODY></HTML>

------=_NextPart_001_0014_01C290C8.9D5D6DC0--

------=_NextPart_000_0013_01C290C8.9D5A6080
Content-Type: application/octet-stream;
	name="testUTF8.pl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="testUTF8.pl"

#!/usr/local/perl5.6.1/bin/perl
require "httpd-paths.ph" || die "$0: can't load httpd-paths.ph: $!\n";
use XML::Simple;
use CGI;
use CGI::Carp;
use utf8;

my $file =3D \*DATA;
my $xmlSimple =3D XML::Simple->new(searchpath =3D> ".", forcearray =3D> =
0,parseropts =3D> [ProtocolEncoding =3D> 'UTF-8']);
my $xml =3D $xmlSimple->XMLin($file);

my $q =3D new CGI;

print "Content-type: text/html; charset=3Dutf-8\n\n";

print <<END;
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
CHARSET=3Dutf-8">
</head>
<body>
END

print <<END;
<form action=3D"/cgi-bin/testUTF8.pl" method=3D"post" =
enctype=3D"multipart/form-data">
<textarea name=3D"text" style=3D"width:400;height:200">
END
$text =3D pack('U*', unpack('U*', $q->param('text')));
if ($q->param('text')) {
  print $text . $xml->{message};
} else {
  print "\x{00F3}\x{00D0}\x{00A1}";
}

print <<END;
</textarea>
<form>
<br>
<input type=3D"submit"><br><br>
END


foreach $i (keys %ENV) {
 print "$i:$ENV{$i} <br>\n";
}

print <<END;
</body>
</html>
END


__DATA__
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<buzz>
  <message>hello</message>
</buzz>
------=_NextPart_000_0013_01C290C8.9D5A6080--