Executing Utf-8 Perl Scripts In Linux

liunx

Guest
Has anyone had success executing a Perl CGI script written in Unicode (e.g. UTF-8)? <br /><br />On my XP development platform such scripts run just like any other. When I upload them to TCH servers, however, I get generic error messages. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> Converting the scripts to US ASCII (and sacrificing some features) allows the same scripts to run.<br /><br />Now I know Perl has great support for all sorts of Unicode features, which I've used reliably before, so I see no good reason why such a script wouldn't run. I've tried uploading in ASCII, binary to no avail.<br /><br />Any thoughts on why this might be the case??<br /><br /><!--coloro:green--><span style="color:green"><!--/coloro-->Update: The above problem no longer exists! Unfortunately I cannot explain why or how <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <!--colorc--></span><!--/colorc--><!--content-->
Hmm, haven't seen this problem before. Not sure if it could be worked around more so than you are already doing either. I'll leave this topic open though just in case anybody else has an opinion or two to share!<!--content-->
I'm experiencing the same problem as well, I'm trying to use an UTF-8 Diary script, which allows me to write in English, Chinese, and Japanese. But it doesnt work on Linux servers ... so I changed UTF-8 to Big-5 ... and now ... I'm only allowed to write my diary in Chinese and English .... even though I speak japanese half of the time.... >_<<!--content-->
I'm not familiar with Perl but what is the difference between a Perl script written in UTF-8 and a Perl script written in another encoding? What I mean is that I don't understand why the Perl interpreter has a problem with the file character encoding being UTF-8...<br /><br />Anyone has an opinion on this one? <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /><!--content-->
perhaps it's not our script's problem, I took a look at the Installed Perl Modules from my cpanel, and I found this line listed:<br /> <br />Encode::Unicode::UTF7 Encode::Unicode::UTF7<br /><br />our CGI are writting in unicode (UTF-8) ... so perhaps this is the reason the server just wont read it? (the server uses 7bit unicode, while we are using 8bit)<!--content-->
Does it help at all to add<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->use utf8<!--c2--></div><!--ec2--><br />to the script? I'm not really familiar with the ins and outs of character encodings, so this is just a shot in the dark.<!--content-->
maybe there's an alternative, which is to convert our UTF-8 to UTF-7<br />unfortunately, there is no tool in windows to do that, and notepad certainly do not support utf-7. <br />I googled a bit, and found out that there is a program called "ConvertUTF" that claimed to be able to convert UTF to/from one to another, the problem is .....<br /><br /><br />I cant find any place to download it .... TT__TT<br /><br />but will general public able to surf UTF-7 sites ? I highly doubt ......<br />so in the end changing it on server side is the only option?<br /><br />ok, it seems like there is no way I can update the Perl on the serverside....<br />I'm going to open a ticket ......<br /><br />(I wonder what version of Perl is the server using? since UTF-8 Unicode support was introduced to Perl 5.6 in yr 2000)<!--content-->
<!--QuoteBegin-thunderforcex+Nov 20 2004, 01:29 PM--><div class='quotetop'>QUOTE(thunderforcex @ Nov 20 2004, 01:29 PM)</div><div class='quotemain'><!--QuoteEBegin-->perhaps it's not our script's problem, I took a look at the Installed Perl Modules from my cpanel, and I found this line listed:<br /> <br />Encode::Unicode::UTF7 Encode::Unicode::UTF7<br /><br />our CGI are writting in unicode (UTF-8) ... so perhaps this is the reason the server just wont read it? (the server uses 7bit unicode, while we are using 8bit)<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=99952"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />I doubt it. Unless your script is using the Encode module, that should have no effect at all. <br /><br />BTW, to answer your last question, TCH (at least the server I'm on) is using Perl 5.8.0. While not having the latest bug fixes (and new bugs), it should be more than adequate. <br /><br />About "use utf8":<br /><br />Perl's official doc says:<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Starting from Perl 5.8.0, the use of use utf8 is no longer necessary...Only one case remains where an explicit use utf8 is needed: if your Perl script itself is encoded in UTF-8, you can use UTF-8 in your <b>identifier names, and in string and regular expression literals</b>, by saying use utf8.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />I no longer remember if I tried that, though I bet I have. As I indicated before, the utf-8 encoded scripts ran fine on XP (or my particular XP Perl), so...that's that. Maybe try again another time. Thanks for all the suggestions <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
 
Back
Top