Re: ASCII Character to Text Conversion



"Jeff Johnson" <i.get@xxxxxxxxxxx> wrote in message
news:ub4jdq%23HJHA.1160@xxxxxxxxxxxxxxxxxxxxxxx

I have a VB 6 app that needs to have functionality to read in information
from a Visual FoxPro table. One of the fields is in ASCII character
format.
Does anyone know of any functionality that will convert the ASCII
character
to standard 'English' text?

Uhhh...what? I have a feeling you don't understand what ASCII is. Have you
looked in this FoxPro table to see the "weird" data contained in this
field? I bet it'll be quite legible....

Okay, this got me going, so please give me a minute for a semi-rant.

OPEN LETTER TO THE WORLD:

Please, everyone who does this, stop using the phrase "ASCII format." ASCII
is not a format, it is an encoding scheme. What's the difference? I'll tell
you.

"Format" refers to structure, a physical layout. Comma-delimited,
tab-delimited, fixed-width files--all of these are formats because they
define a structure that decribes how the data within them is stored.
Likewise for HTML and XML. Date formats like mm/dd/yyyy, dd/mm/yyyy,
yyyy-mm-dd all define a structure: how the parts of a date are physically
arranged for display and how they are to be interpreted when read.

An "encoding scheme" is nothing more than a translation matrix, a lookup
table. The word "code" is contained in there, and for good reason: an
encoding scheme serves to turn something human-recognizable (letters and
digits, for example) into something less recognizable (numbers). Numbers are
the only thing computers understand, so to store letters we have to turn
them into numbers, but we also need to be able to turn them back into
letters so that we can read them.

Here's a simple encoding: I'll write my name using a code which simply
converts a letter into a number based on its position in the alphabet (A
being 1 and Z being 26). This particular encoding makes no distinction
between upper- and lower-case letters.

10 5 6 6 [10 = J, 5 = E, 6 = F (twice)]

ASCII does the same thing, except it defines 128 things and not just the 26
letters of the alphabet that my simple code did. The first 32 (0 - 31) don't
represent displayable characters but rather contain control codes that were
useful on older terminals (and many of which still work on a command
prompt). 32 - 127 represent characters which, if not completely visible
(like a space), still occupy physical...uh...space. The letters A - Z are
represented twice, once in upper-case (65 - 90) and once in lower (97 -
122). All ACSII characters can be represented with a single byte.

Unicode is another encoding scheme which attempts to encode every possible
character in all languages on Earth, and to do so it uses bigger numbers and
potentially more than one byte to hold those numbers (which leads to all
sorts of fun in the various FORMATS used to manage an ENCODING SCHEME--ha!).

My point is that nothing can be "formatted as ASCII" because ASCII doesn't
describe how various characters are to be laid out. It simply says "65 = A,
49 = 1, 63 = ?, 98 = b, etc." The following lines all contain ASCII
characters:

1,West,2008-01-03
<id>1</id><region>West</region><processDate>2008-01-03</processDate>
1 West 2008-01-03

but they have been formatted (laid out) in different ways. You would need to
know the format to properly process the data they contain, but no matter
what, the "W" is always represented by 87.


.



Relevant Pages

  • Re: ASCII Character to Text Conversion
    ... One of the fields is in ASCII character ... Does anyone know of any functionality that will convert the ASCII ... Please, everyone who does this, stop using the phrase "ASCII format." ... it is an encoding scheme. ...
    (microsoft.public.vb.general.discussion)
  • Re: binary i/o files
    ... I am able to store the values in an ASCII format. ... but unless you put line-termination characters in at the end ...
    (comp.lang.fortran)
  • Re: Find/ replace multi-line segments?
    ... As long as you haven't done so, the text file might contain Ascii ^10 characters that are hard to deal with. ... If that still doesn't work, you could select the characters one by one, and run the following code in the VBA immediate window: ... It's not a native Word file; it's some funky Plain Text format. ...
    (microsoft.public.word.newusers)
  • Re: Whats wrong with my line counter script?
    ... format, so it defaults to ASCII, according to the documentation. ... You could read the first two characters (as ASCII) -- I've never seen ... a Unicode file read fail in the first two characters. ...
    (microsoft.public.scripting.vbscript)
  • Re: Report enhancements
    ... >Specifies a set of 128 control and graphic characters such as letters, ... >The essential features of this format are portability and editability. ... >Allowing binary stuff sabotages the Standard for Information ... There is a standard definition of ASCII text files -- a blend of ISO ...
    (comp.lang.cobol)

Loading