homepage Welcome to WebmasterWorld Guest from 54.211.230.186
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
how to print unicode in a perl script
how to print uniode in a perl script
StopSpam

10+ Year Member



 
Msg#: 3615 posted 5:10 pm on May 12, 2004 (gmt 0)

I hope this is a easy question ..

i have made a test perl script that prints out
a html page and in one frame i wish to
print unicode so it shows the unicode code in the page.
Without the page converting the code back

so the code must remain code .. not hmtl /text..

so the out put will be a webpage that
shows in a table some unicode

i hope you udnerstand what i mean ..

i try this .. but it still prints the unicode as html not as code

#### sample #####

#!/usr/local/bin/perl
print "Content-Type: text/html\n\n";

print <<HTML_A;
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER><BR>
here is a sample of the unicode<BR>
<BR>
<TABLE BORDER=1 WIDTH="66%">
<TR>
<TD>
<CENTER>
HTML_A

#### html sample here #####

print "&#119;&#101;&#98;&#109;&#97;&#115;&#116;&#101;&#114;&#64;&#109;&#121;&#83;&#105;&#116;&#101;&#46;&#99;&#111;&#109;\n";

#### End html sample #####

print <<HTML_B;
</TD>
</TR>
</TABLE>
<BR>
<BR>
copy and past the code</CENTER>
</BODY>
</HTML>

HTML_B

exit;

 

VectorJ

10+ Year Member



 
Msg#: 3615 posted 6:59 pm on May 12, 2004 (gmt 0)

You could replace the & symbol with its html code counterpart in the string:


$unicode = '&#119;&#101;&#98;&#109;&#97;';
$unicode =~ s/&/&#38;/g;

The $unicode string when printed in a browser would look normal for copy-and-paste operations.

StopSpam

10+ Year Member



 
Msg#: 3615 posted 7:39 pm on May 12, 2004 (gmt 0)

thank you very mush : VectorJ

This works perfectly :-)
i would myself never thought of this trick ....

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved