Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Perlscript in IIS and 2 byte character codes

by Lexicon (Chaplain)
on Jun 12, 2001 at 08:14 UTC ( #87721=snippet: print w/replies, xml ) Need Help??
Description: I've been fighting with ways to embed Japanese text into my perl asp/cgi pages. For those of you in a similar situation the short answer is, "It can't be done." So I came up with this rediculous hack which happens to do the particular job I need done in this instance.
<%@ Language = PerlScript %>
  <title> Japanese Perl Integration Trick #1 </title>

<h2>Lexicon's Loan Book</h2>
Those of you visiting this page almost assuredly owe me
money.  You remember all those yen I lent you while you
were in town?  Time to pay up!<p>

Obligatory Japanese<p>

# People who owe me cash (or, sample hash)
my %loans = { 
              'Vroom'        => 5000,
              'PsychoSpunk'  => 10000,
              'Azatoth'      => 10000000,

# Some basic basic html templating
my $table_start = "<tr><td width='50%' bgcolor='red'>";
my $table_mid   = "</td><td width='50%' bgcolor='blue'>";
my $table_end   = "</td></tr>";

# Wherever you call this subroutine, the yen mark will appear.  
# Remember that it pops up instantly, it doesn't return the string.
sub yen { %> 円 <% } # The Japanese character for yen.

%> <table> <%

# Here we go, actual use:
for (keys %loans) {
  $Response->write( $table_start 
                  . $_ 
                  . $table_mid 
                  . %loans{$_} 
                  . &yen 
                  . $table_end 
Replies are listed 'Best First'.
Re: Perlscript in IIS and 2 byte character codes
by John M. Dlugosz (Monsignor) on Jun 13, 2001 at 00:50 UTC
    What's wrong with using UTF8?
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://87721]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2017-04-25 19:48 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (463 votes). Check out past polls.