Jump to content

Executing Utf-8 Perl Scripts In Linux


Recommended Posts

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. :huh: 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 by a__kc
Link to post
Share on other sites
  • 11 months later...

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.... >_<

Link to post
Share on other sites

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? :ph34r:

Link to post
Share on other sites

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)

Link to post
Share on other sites

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)

Link to post
Share on other sites
  • 1 month later...
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)

 

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 :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...