>I'm new to Perl and am using BBEdit to edit scripts. I just can't
>figure out how to easily type in characters with accents. For
>example to get usuário I have to put in  usu·rios for Vocę I have to
>type in VocÍ

if it's just a question of entering the character, the ascii floater
in bbedit will probably be easiest. window menu -> ascii table,
double click for the %mumble or apple-doubleclick for the character.

but remember that the upper part of the mac ascii table isn't the
same as on other platforms. have a look at perldoc perlport (or
http://www.perldoc.com/perl5.6/pod/perlport.html ) for lots of stiff
warnings about platform variation and some useful advice.

bbedit also has a similar floater for html entities, which is
probably all you need. even better, the translate command will
automatically turn your accented characters into the entity
equivalents, eg é -> é

out of curiosity, i did some fiddling about with this:

#!/usr/bin/perl

print "Content-type:text/plain\n\n";
print "ńö háblŕ espanől\n";

and found that the only place it works as expected is on the os x
command line, either locally or on a remote server. through a browser
it always comes up as '-sť hýbl– espanđl', whatever the native set is
on the server or client. it seems that perl on os x uses the mac
roman character set until run under cgi, at which point it prints
7bit ascii. You can confirm this by running:

#!/usr/bin/perl
print("$_ = " . chr($_) . "\n") for (32..255);

which produces different results in the terminal and the browser.

if this proves to be a problem, and you must have raw accented text
inside your script, you can either print through a translation table
from mac ascii to the standard/other version, or (more portable) do
it all in unicode. the recommended way to do either of these seems to
be the Text::Iconv module, but i couldn't get it to make, as os x
doesn't provide the iconv.h that it wraps around. does anyone know a
fix?

thanks

will


ps. i'd be grateful if people would correct any misconceptions here.



--











pgpkey: http://www.spanner.org/keys/will.txt

Reply via email to