perl print ASCII

M

mud_saisem

Hi All,

Can anybody tell me how to print ASCII characters in perl ?

eg: I would like to print the following ASCII character in perl using
the following Alt 63214, which gives you ¯

So at the end of the day i would like perl to print the following



This is my perl line, with a underline !
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
J

Jürgen Exner

mud_saisem said:
Can anybody tell me how to print ASCII characters in perl ?

For printable ASCII characters you just print them like in

print "This is an unsorted list of some ASCII characters";
eg: I would like to print the following ASCII character in perl using
the following Alt 63214, which gives you ¯

That is not one of the 95 printable ASCII character (and neither one of
control characters), see
http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

jue
 
M

mud_saisem

For printable ASCII characters you just print them like in

        print "This is an unsorted list of some ASCII characters";


That is not one of the 95 printable ASCII character (and neither one of
control characters), seehttp://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

jue

Thanks for the response Jue, I understand that my use of the words
"ASCII characters" was not entirely correct, but I was not sure how
else to describe what I was after.

What I am after is a way to print ¯ character in perl and i am not
sure how to do it.
 
S

sln

Hi All,

Can anybody tell me how to print ASCII characters in perl ?

eg: I would like to print the following ASCII character in perl using
the following Alt 63214, which gives you ¯

So at the end of the day i would like perl to print the following



This is my perl line, with a underline !

(now the underline is under some different line)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Unicode combining diacritics.
http://www.answers.com/topic/combining-character

In digital typography, combining characters are characters that are intended
to modify other characters. The most common combining characters in the
Latin script are the combining diacritical marks (including combining accents).

Unicode also contains many precomposed characters, so that in many cases
it is possible to use both combining diacritics and precomposed characters,
at the user's or application's choice. This leads to a requirement to perform
Unicode normalization before comparing two Unicode strings and to carefully
design encoding converters to correctly map all of the valid ways to represent
a character in Unicode to a legacy encoding to avoid data loss.[1]

In Unicode, the main block of combining diacritics for European languages and the
International Phonetic Alphabet is U+0300–U+036F.
Combining diacritical marks are also present in many other blocks of
Unicode characters. In Unicode, diacritics are always added after the
main character. It is thus possible to add several diacritics to the same
character, although as of 2006, few applications support correct rendering of
such combinations ....

________________________________
For your reading enjoyment.
-sln
 
J

Jürgen Exner

mud_saisem said:
What I am after is a way to print character in perl and i am not
sure how to do it.

I still don't understand where you got a problem. A simple
print '¯';
will print the overscore character just fine.

Maybe you got a cross-code page problem? Your Perl program written in
one code page but your program run in a different code page? Like your
program written in Notepad (e.g Windows-1252 or UTF-8) but run in a DOS
command prompt (e.g. DOS CP437 or CP850)?

jue
 
R

RedGrittyBrick

mud_saisem said:
Thanks for the response Jue, I understand that my use of the words
"ASCII characters" was not entirely correct,

your use of "ASCII characters" was, unfortunately, entirely incorrect.
but I was not sure how
else to describe what I was after.

The character you want is a character in the Latin-1 (ISO 8859-1)
encoding. It's code point is 0xAF. It's name is Macron. I believe it is
intended to be used in composing certain long vowels in some languages
or in transliterations of some other languages.
What I am after is a way to print ¯ character in perl and i am not
sure how to do it.

You need to be clear about the encoding of the text file containing your
Perl program and the encoding in use by the display device. If both are
using ISO 8859-1 (or similar) you should be able to "print '¯';"

C:\>chcp 1252
Active code page: 1252

C:\>perl -e "print qq(XX\n¯\xAF)"
XX
¯¯
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top