cancel
Showing results for 
Search instead for 
Did you mean: 

UTF-8/Perl

njh1
Dabbler
Posts: 17
Registered: 06-08-2007

UTF-8/Perl

Has anyone ever got UTF-8 output to work on Force9? They use a very old version of Perl and I'm not sure it supports it.

If I try the script below it works fine at home and other ISPs, but with F9 I just get the {....} output...

Also use strict fails at F9, but that's less important than UTF8 notworking.

#!/usr/bin/perl -w

# Can't use strict at F9 otherwise you get:
# Can't use string (":utf8") as a symbol ref while "strict refs" in use
# at /home/nigelhorne/cgi-bin/utf8.pl?
# use strict;

use CGI::Carp qw(fatalsToBrowser);

binmode(STDOUT, ':utf8');
print "Content-type: text/html; charset=UTF-8\n";
print "\n";

print "<HTML><BODY>\n";
print "\x{30AA}\x{30FC}\x{30B9}\x{30C8}\x{30E9}\x{30EA}\x{30A2}",
print "</HTML></BODY>\n";
2 REPLIES
N/A

UTF-8/Perl

I dont get an error using strict, your error is to do with utf8. You would have encountered an error at the use strict; statement otherwise.

Why not create a CGI object instead of just printing out the html - that is what the module is for Cheesy . I dont have time to knock something up just now to try it myself as I have had a few beers. I am tired and struggling to stay awake and I look like this --> :shock:
njh1
Dabbler
Posts: 17
Registered: 06-08-2007

UTF-8/Perl

Indeed the 'use strict' is a different issue - I did make that plain in my original posting - it's the UTF8 not working that I want help with.