Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know an ASCII character takes 8 bits but how do you print a character on screen with those bits?

share|improve this question
What operating system? Where? command line? programming language? – Mikel Jan 24 '11 at 21:44
ASCII actually only takes 7 bits. – Ignacio Vazquez-Abrams Jan 24 '11 at 21:44
I really meant how a character is represented on screen. How does 7 bits make up a 'character print'. – user32344 Jan 24 '11 at 21:46
up vote 3 down vote accepted

The byte is used as a lookup in a font table, and the appropriate pixels are lit for that character at the appropriate position.

share|improve this answer
What could be the maximum number of pixels allowed for character? – user32344 Jan 24 '11 at 21:47
not only "the byte" but also (in unicode environments) any other glyph. you take the 'code', search for the visual representative in a lookup table and then you render it. ignacios answers is the correct one. – akira Jan 24 '11 at 21:48
@user32344: you can lookup a glyph in a vector font ... so you can render it with as much pixels as you like. – akira Jan 24 '11 at 21:49
It is completely dependent on the mechanism used for displaying the pixels on-screen, but a 8×16 cell is usually more than enough for PC text mode. – Ignacio Vazquez-Abrams Jan 24 '11 at 21:49
@user32355 Most fonts these days are represented by vector information. That way there is virtually no maximum size limit to the font. – BloodPhilia Jan 24 '11 at 21:50

You mean rather than doing

echo a

You want to type

echo 00111101

or something?

I think you'd have to convert it from binary to octal first. Then you can do:

echo -e "\0141"
share|improve this answer
$ printbin () { printf "\\$((2#$1/64*100+2#$1%64*10+2#$1%8))\n"; }
$ printbin 1000001
$ printbin 1100001
share|improve this answer

In Windows, you can use a character's Alt character code to print it by pressing Alt + [code] on the Numpad. In some cases, the Alt character code coincides with its Unicode character code.

Example: Alt + 250 = ú

You can find the whole list of Alt codes by running the Character Map applications (charmap.exe).

share|improve this answer
-1: The code isn't Unicode. It's the Windows Alt Key code – Wuffers Jan 24 '11 at 22:18
You're right. However, many Alt Key codes coincide with the character's Unicode character code. Sorry for the confusion. – Juliana Peña Jan 25 '11 at 2:23
yep.. the ascii codes do overlap unicode. it's also possible to type unicode(in hex) from the numpad, but entering unicode like that may be dependent on application +1 to cancel the downvote of -1! – barlop Jan 30 '11 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .