a__kc Posted December 1, 2003 Posted December 1, 2003 (edited) Has anyone had success executing a Perl CGI script written in Unicode (e.g. UTF-8)? 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. Converting the scripts to US ASCII (and sacrificing some features) allows the same scripts to run. 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. Any thoughts on why this might be the case?? Update: The above problem no longer exists! Unfortunately I cannot explain why or how Edited January 15, 2005 by a__kc Quote
TCH-Sales Posted December 5, 2003 Posted December 5, 2003 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! Quote
thunderforcex Posted November 20, 2004 Posted November 20, 2004 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.... >_< Quote
borfast Posted November 20, 2004 Posted November 20, 2004 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... Anyone has an opinion on this one? Quote
thunderforcex Posted November 20, 2004 Posted November 20, 2004 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: Encode::Unicode::UTF7 Encode::Unicode::UTF7 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) Quote
schussat Posted November 20, 2004 Posted November 20, 2004 Does it help at all to add >use utf8 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. Quote
thunderforcex Posted November 20, 2004 Posted November 20, 2004 maybe there's an alternative, which is to convert our UTF-8 to UTF-7 unfortunately, there is no tool in windows to do that, and notepad certainly do not support utf-7. 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 ..... I cant find any place to download it .... TT__TT but will general public able to surf UTF-7 sites ? I highly doubt ...... so in the end changing it on server side is the only option? ok, it seems like there is no way I can update the Perl on the serverside.... I'm going to open a ticket ...... (I wonder what version of Perl is the server using? since UTF-8 Unicode support was introduced to Perl 5.6 in yr 2000) Quote
a__kc Posted January 9, 2005 Author Posted January 9, 2005 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: Encode::Unicode::UTF7 Encode::Unicode::UTF7 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) <{POST_SNAPBACK}> I doubt it. Unless your script is using the Encode module, that should have no effect at all. 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. About "use utf8": Perl's official doc says: 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 identifier names, and in string and regular expression literals, by saying use utf8. 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.