Re: Can I upload Perl program in unicode?



On 2008-07-28 20:21, John <john1949@xxxxxxxxx> wrote:
Imagine that I have the following statement in a Perl program.

my $word = '??';

These are two question marks. I suppose that should have been something
else. If you want to write non-ASCII characters in your postings, please
use a newsreader which is able to do so.


If I save the Perl program as 'UTF8' the characters remain.

If I save it in ASCII, the line appears as my $word = '??????';

Now, the problem is although I can save it as UTF8 the Perl program needs to
be in ASCII to be run

Why? The perl interpreter is perfectly fine with scripts in UTF-8.


How do I get around this problem?

I could tell you, but then I'd have to kill you.

No, seriously, you seem to be lacking some basics about perl character
strings, so I'll refer you to Juerd's rather good Unicode tutorial:
http://juerd.nl/site.plp/perluniadvice

hp
.



Relevant Pages

  • RE: Pattern Match
    ... Rob, can you explain the details of that replace? ... > I am very new to Perl, but I sense a great adventure ahead after just ... not a list of characters. ... to the ASCII value of the control character grabbed by the regex. ...
    (perl.beginners)
  • Re: Tidy using unicode does not validate
    ... Dos and tidy the file in ascii. ... I don't know about the specific software, but leaving the file in ASCII, ... you have relatively few non-ASCII characters, ... cannot be interpreted as utf-8. ...
    (alt.html)
  • Re: Tk und locale
    ... dass das irgendein Superset von ASCII sein muss, ... Wenn du also eine Operation wie ucor $str ... dann ist es ein Bug. ... schickt jede Menge Patches an die perl 5 porter. ...
    (de.comp.lang.perl.misc)
  • Re: Trying to read a multiline string
    ... In this format, Perl can read it, no problem. ... Is this an ascii representation of a binary line of data? ... code for endline is used to represent a number in binary data. ...
    (perl.beginners)
  • Re: Tidy using unicode does not validate
    ... is a bit vague and doesn't list down the software that doesn't grok the BOM, but the symptoms it mentions (an extra line or the funny characters  aren't really catastrophic. ... Dos and tidy the file in ascii. ... I don't know about the specific software, but leaving the file in ASCII, presumably with the software presenting any non-ASCII characters as character or entity references like – or &ndash:, is a good option, if you have relatively few non-ASCII characters, so that it's not significant in terms of amount of data. ...
    (alt.html)