output becomes unicode

L

Leif Wessman

Sorry for this silly question. I've seeked for answer but haven't found
anything.

This simple program:

--
#!/usr/bin/perl
use strict;
use warnings;
print "åäö";
--

prints "åäö" (unicode characters)

Is that a normal behaviour? I would like to see "åäö" instead. Is it
possible to change?

I'm using v5.8.0.

Leif
 
J

Jürgen Exner

Leif said:
Sorry for this silly question. I've seeked for answer but haven't
found anything.

This simple program:

--
#!/usr/bin/perl
use strict;
use warnings;
print "åäö";

[Rest of posting being snipped as signature; don't do that]
[Manually re-attached]
prints "åäö" (unicode characters)

So? "åäö" are unicode characters, too. As are "abcdef...".
Virtually all commonly used character sets are included in Unicode,
therefore saying "x" is a Unicode character doesn't bear much information.
Is that a normal behaviour? I would like to see "åäö" instead. Is it
possible to change?

It seems your Perl system (or the editor you are using to type and display
your Perl program) and whatever you are using for display at runtime
(xterm?) don't agree on the encoding. Did you try a simple "cat
myperlprogram.pl"? You probably will see the same distortion.

Just change your display devise to the same encoding as you are using to
type your programs. How to do that, well, that depends on what you are using
to display the execution results of your program.

jue
 
A

Alan J. Flavell

On Fri, 3 Sep 2004, Leif Wessman wrote:

[...]
prints "åäö" (unicode characters)

Well, your posting headers say:

Content-Type: text/plain; charset="iso-8859-1"

- so what you just posted was really a string of six iso-8859-1
characters (not three "unicode" characters as you claimed).
Is that a normal behaviour? I would like to see "åäö" instead. Is it
possible to change?

I'm using v5.8.0.

My hunch is that you have a locale set which has utf-8 in it.

What's the OS (redhat linux 9, for example?). Then this would be a
known[1] problem. Either take the utf-8 out of the locale (for legacy
behaviour), or upgrade to using utf-8 consistently (for the future).

good luck

[1] Hint: google for terms like > rh9 perl.5.8 utf-8 locale <
 
P

Peter J. Acklam

Jürgen Exner said:
Leif said:
Sorry for this silly question. I've seeked for answer but
haven't found anything.

This simple program:

--
#!/usr/bin/perl
use strict;
use warnings;
print "åäö";

[Rest of posting being snipped as signature; don't do that]
[Manually re-attached]

Perhaps you should fix your newsreader so it doesn't consider "--"
as a signature separator.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top