From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60973b026c6e423d X-Google-Attributes: gid103376,public From: dewar@schonberg.cs.nyu.edu (Robert Dewar) Subject: Re: help: character to integer Date: 1996/10/05 Message-ID: #1/1 X-Deja-AN: 187735665 references: <52s2pl$18l@dailyplanet.wam.umd.edu> <52t8la$2l8@goanna.cs.rmit.edu.au> <3252BEC8.529E@lmco.com> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-05T00:00:00+00:00 List-Id: iGeorge said " Forgive my ignorance, but is there any guarantee that Character'POS('X') = {ASCII code for 'X'}? Especially now that Ada uses ISO Latin-1 (or whatever the standard actually calls for). Are ASCII and Latin-1 two names for the same standard? (I assume that they are at least equivalent for "well-behaved" characters as the solution probably works empirically.){" ASCII is essentially an obsolete standard at this point. For all practical purposes, ASCII is equivalent to the lower 128 characters of Latin-1, and so for example, the answer to your question about 'X' is a definite yes. Unlike other languages, the type Character is well defined in Ada, and not subject to host/target considerations (for example, even on an EBCDIC machine, an Ada compiler would provide a type Character matching Latin-1) So there is nothing empirical here, the behavior is completely well defined by the reference manual. The reason that I say "for all practical purposes" is that ASCII is a little bit fuzzy, especially if you roam around different countries. ASCII is actually a specialized US version of an (obsolete) international standard that allows variations from country to country. Some symbols, like $ :-) are international. But for example, the symbol for 16#23# which is # in the US version, is the pound stirling symbol in the UK (this is why # on a US touch tone phone is called the pound key). Latin-1 on the other hand does not have national variations. This means that if you are in say Sweden, people will think of ASCII as having symbols for letters like A-circle. This is not quite correct thinking, because it is not ASCII anymore, but in any case all these problems disappear when using Latin-1. Note: although Latin-1 support is required, Ada compilers may allow localization options for different character sets. For example the GNMAT compiler itself allows the following character sets for Ada identifiers Latin-1 Latin-2 Latin-3 Latin-4 IBM PC (standard US version) IBM PC code page 850 (European version) Full upper half We currently don't provide corresponding library packages for the children of Ada.Characters for these sets, but we could (if anyone really needed them, I wonder if anyone using Ada uses Latin-2 or Latin-4???) But in standard mode, Latin-1 is the set, and you can count on it.