Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > What exactly is a text character in the computer?

Reply
Thread Tools

What exactly is a text character in the computer?

 
 
Simon Biber
Guest
Posts: n/a
 
      10-03-2005
Joe Wright wrote:
> Emmanuel Delahaye wrote:
>
>> http://www.velocityreviews.com/forums/(E-Mail Removed) wrote on 02/10/05 :
>>
>>> Ok, I know all about how binary numbers translate into text characters.
>>> My question is what exactly IS a text character? Is it a bitmap?

>>
>>
>>
>> A text file is just another binary file. What counts is the way it is
>> opened and read. Use fopen() with "r", so that the end of line markers
>> and end of file marker (if exist) will be correctly interpreted.
>>
>> I recommend fgets() for a line-oriented reading
>>
>> Similary, when you create a text file, be sure to open it in text mode
>> ("w" or "a") so that the '\n' character is properly encoded on the file.
>> (The actual value is compiler dependent). Not to mention that some
>> system (say MS-DOS) append a special character (say Ctrl-Z) to mark
>> the end of text files.
>>

>
> Don't frighten the children. If you fopen() a text file with mode "r"
> you will never see '\r' nor 0x1a (^Z). Trust me on this.


Unfortunately, if you try to open an MS-DOS, Windows or Mac OS text file
on a Unix-style system with fopen mode "r", you will see '\r'
characters. If people used tools like ftp to transfer files between
computers, which can be told to handle files as text or binary, then if
told to use text it will handle the format conversion properly. However,
most recent methods of file transfer just copy the files exactly, and
don't convert text formats. It is left up to the destination application
to be robust to different formats.

My point is that portable C applications can no longer afford to just
use fopen in text mode and hope that the file is in the same format that
the local C library was expecting. It makes more sense to read files as
binary, and be robust to all the competing text file formats. Not just
different line endings (CR, CRLF and LF), but different character
encodings as well. I have text files in UTF-8, UTF-16, ISO-8859-1,
GB2312 and Big5 here. Wherever possible, I expect programs to not barf
on any of those formats.

--
Simon.
 
Reply With Quote
 
 
 
 
John Bode
Guest
Posts: n/a
 
      10-03-2005

(E-Mail Removed) wrote:
> Ok, I know all about how binary numbers translate into text characters.
> My question is what exactly IS a text character? Is it a bitmap?


That depends *entirely* on the output device. A bitmap works for a
raster display, but not so well for a vector display or a teletype.

This is way beyond the scope of the C programming language, btw.

 
Reply With Quote
 
 
 
 
Martijn
Guest
Posts: n/a
 
      10-04-2005
Eric Sosman wrote:
> Martijn wrote:
>
>> (E-Mail Removed) wrote:
>>
>>> My question is what exactly IS a text character? Is it a
>>> bitmap?

>>
>>
>> This is so off-topic, you wouldn't believe it. Although I shouldn't
>> do this (because it may encourage others to post OT here as well):
>>
>> <OT>
>> In the old days (and still today if you switch to CLI/DOS mode or
>> run a UNIX-like OS without a GUI like X) the characters were stored
>> in memory in a special location (setting some pointers in the BIOS
>> memory, you could override these) as bitmaps. The characters (or
>> glyphs) used in GUI's like Windows and X use more often than not a
>> combination of curves (and sometimes hints) to describe what they
>> should look like. </OT>

>
> Nonsense. In the old days, characters were little metal
> dies that pressed an inked ribbon against paper (various
> mechanical arrangements were used). With the right sequences of
> characters you could get some printers to emit sounds that had
> pitch and could produce recognizable tunes, but that tended to
> eat holes in the ribbon and earn you a stern talking-to from the
> computer operators.


Characters? In the old days?



--
Martijn
http://www.sereneconcepts.nl


 
Reply With Quote
 
Martijn
Guest
Posts: n/a
 
      10-04-2005
Walter Roberson wrote:
> In article <433ff6f4$0$11071$(E-Mail Removed)4all.nl>,
> Martijn <(E-Mail Removed)> wrote:
>> (E-Mail Removed) wrote:
>>> My question is what exactly IS a text character? Is it a
>>> bitmap?

>
>> <OT>
>> In the old days (and still today if you switch to CLI/DOS mode or
>> run a UNIX-like OS without a GUI like X) the characters were stored
>> in memory in a special location (setting some pointers in the BIOS
>> memory, you could override these) as bitmaps.

>
> Character bitmaps stored in BIOS-accessible memory is a new-fangled
> innovation. Real video character bitmaps are pulled from ROM in a
> character-generator circuit.


You are right - I remember specifically liking the glyphs of one video card,
while disliking those of another (I think the latter was the Diamond Fire).
Either way I was saying that setting some pointers in the mapped BIOS memory
space - I am not sure which ones anymore - allowed you to specify one or two
alternate sets, not that they were actually stored in the BIOS. Hopefully I
am using proper nomenclature here, because I am not sure that I am.

--
Martijn
http://www.sereneconcepts.nl


 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      10-05-2005
In article <434418e1$0$11069$(E-Mail Removed)4all.nl>,
Martijn <(E-Mail Removed)> wrote:
>Walter Roberson wrote:
>> Character bitmaps stored in BIOS-accessible memory is a new-fangled
>> innovation. Real video character bitmaps are pulled from ROM in a
>> character-generator circuit.


>You are right - I remember specifically liking the glyphs of one video card,
>while disliking those of another (I think the latter was the Diamond Fire).
>Either way I was saying that setting some pointers in the mapped BIOS memory
>space - I am not sure which ones anymore - allowed you to specify one or two
>alternate sets, not that they were actually stored in the BIOS. Hopefully I
>am using proper nomenclature here, because I am not sure that I am.


BIOS?? You must be one of them Pro-gress-ives chaps. You probably
didn't even build your own terminal !! Back in my day, we had to worry
about re-using scan lines in the ROM because 256 byte ROMs were so
expensive.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
 
Reply With Quote
 
Lew Pitcher
Guest
Posts: n/a
 
      10-06-2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Walter Roberson wrote:
> In article <434418e1$0$11069$(E-Mail Removed)4all.nl>,
> Martijn <(E-Mail Removed)> wrote:
>
>>Walter Roberson wrote:
>>
>>>Character bitmaps stored in BIOS-accessible memory is a new-fangled
>>>innovation. Real video character bitmaps are pulled from ROM in a
>>>character-generator circuit.

>
>
>>You are right - I remember specifically liking the glyphs of one video card,
>>while disliking those of another (I think the latter was the Diamond Fire).
>>Either way I was saying that setting some pointers in the mapped BIOS memory
>>space - I am not sure which ones anymore - allowed you to specify one or two
>>alternate sets, not that they were actually stored in the BIOS. Hopefully I
>>am using proper nomenclature here, because I am not sure that I am.

>
>
> BIOS?? You must be one of them Pro-gress-ives chaps. You probably
> didn't even build your own terminal !! Back in my day, we had to worry
> about re-using scan lines in the ROM because 256 byte ROMs were so
> expensive.


Well, ain't you fancy!!

I still have a printer that you can change the print head on to get different
characters for the same codepoint. The one I have downstairs is a
"daisy-wheel" printer that used a print head shaped like a 100-petal daisy.
Each petal has a different glyph embossed in it's surface, and the printer
rotates the print head to position each glyph behind a hammer.

My old Teletype ASR33 used a cylinder which had 60 or so glyphs embossed on
it. The hardware rotated the cylinder so that the proper glyph was positioned
behind the print hammer.

In both cases, the hammer whacked the print head, which drove the embossed
glyph into the print ribbon, and smacked the ribbon against the paper, leaving
an imprint of the glyph in ribbon ink on the paper. No fancy ROMs or BIOS for
those babies. Just good old typewriter and printing press technology.




- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFDRHcAagVFX4UWr64RAprpAKCfIqxj1jRFt2CV99IV4W 6Df0PatACglSEj
vWHiYCccKxvErfyEdqJnq0Y=
=3dqM
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-08-2005
"Rouben Rostamian" <(E-Mail Removed)> wrote in message
news:dhov40$di3$(E-Mail Removed)...
> In article <(E-Mail Removed)>,
> Eric Sosman <(E-Mail Removed)> wrote:
> >Martijn wrote:
> >> (E-Mail Removed) wrote:
> >>>My question is what exactly IS a text character? Is it a
> >>>bitmap?
> >> This is so off-topic, you wouldn't believe it. Although I

shouldn't do this
> >> (because it may encourage others to post OT here as well):
> >> In the old days (and still today if you switch to CLI/DOS mode or

run a
> >> UNIX-like OS without a GUI like X) the characters were stored in

memory in a
> >> special location (setting some pointers in the BIOS memory, you

could
> >> override these) as bitmaps. The characters (or glyphs) used in

GUI's like
> >> Windows and X use more often than not a combination of curves (and

sometimes
> >> hints) to describe what they should look like.

> > Nonsense. In the old days, characters were little metal
> >dies that pressed an inked ribbon against paper (various
> >mechanical arrangements were used). With the right sequences of
> >characters you could get some printers to emit sounds that had
> >pitch and could produce recognizable tunes, but that tended to
> >eat holes in the ribbon and earn you a stern talking-to from the
> >computer operators.

> Nonsense. Everyone knows that in the old days, characters
> were shapes chiseled in stone.


Chisels? You were lucky.
In the old days, we had to lick shapes into the stones with our tongues.
Whole villages were forced into slavery for 5 years just to make one
"Keep Left" sign.

--
Mabden


 
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
character encoding +missing character sequence raavi Java 2 03-02-2006 05:01 AM
getting the character code of a character in a string Velvet ASP .Net 9 01-19-2006 09:27 PM
warning: multi-character character constant...help me! mimmo C Programming 4 04-10-2004 08:15 PM
Character reference "&#c" is an invalid XML character cgbusch XML 6 09-02-2003 07:04 PM
question: reading character for character from stdin KwikRick Python 1 08-22-2003 05:56 PM



Advertisments