Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl print ASCII

Reply
Thread Tools

perl print ASCII

 
 
mud_saisem
Guest
Posts: n/a
 
      10-01-2009
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 !
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      10-01-2009
mud_saisem <(E-Mail Removed)> wrote:
>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#A...ble_characters

jue
 
Reply With Quote
 
 
 
 
mud_saisem
Guest
Posts: n/a
 
      10-02-2009
On Oct 2, 9:40*am, Jürgen Exner <(E-Mail Removed)> wrote:
> mud_saisem <(E-Mail Removed)> wrote:
> >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), 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.
 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      10-02-2009
On Thu, 1 Oct 2009 16:01:20 -0700 (PDT), mud_saisem <(E-Mail Removed)> wrote:

>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

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      10-02-2009
mud_saisem <(E-Mail Removed)> wrote:
>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- but run in a DOS
command prompt (e.g. DOS CP437 or CP850)?

jue
 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      10-02-2009

mud_saisem wrote:
> On Oct 2, 9:40 am, Jürgen Exner <(E-Mail Removed)> wrote:
>> mud_saisem <(E-Mail Removed)> wrote:
>>> 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), 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,


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
¯¯

--
RGB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Regex with ASCII and non-ASCII chars TOXiC Python 5 01-31-2007 04:48 PM
[FR/EN] how to convert the characters ASCII(0-255) to ASCII(0-127) Alextophi Perl Misc 8 12-30-2005 10:43 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM
routine/module to translate microsoft extended ascii to plain ascii James O'Brien Perl Misc 3 03-05-2004 04:33 PM



Advertisments