Since the computer uses only numbers to represent everything, the alphabet and other characters are assigned a number. Capital A=65, 0 (zero number character) = 49.
The definitions exist for EVERY character you can type, including the <enter> key.
The definition of these characters is a world-wide standard, it is called ASCII. When you set your computer to use languages that have complicated sets of glyphs, the new rules (numbers for each glyph) are stored in locale settings. These are special, not ASCII usually.
The default locale is named "C". After the computer language C. That locale uses ASCII.
Computers are all about numbers and number crunching, so everything boils down to how numbers are stored in memory - they are stored as base2 numbers - binary - only ones and zeroes are allowed.
The C and POSIX standards do not require that the C (and POSIX) Locales be based on the ASCII codeset. The POSIX standards do require that the collation order of the 128 characters in the ASCII codeset is the same as the binary byte order of the ASCII characters no matter what the actual underlying codeset is. This guarantees that if you sort text files that only contain characters from the portable character set (which omits some of the ASCII control characters), the text will sort into the same order on a machine no matter what codeset is underlying the C and POSIX Locales. Note that to make this happen when sorting, you have to compare strings using the locale's collating order (like you get using strcoll()); not the numeric values of bytes (like you get using strcmp()).
There are UNIX branded implementations where the codeset underlying the C and POSIX Locales is a superset of ASCII (such as UTF-8 or one of the ISO 8859-* standards) where all of what Jim said above are true, but there are also implementations where the codeset underlying the C and POSIX Locales is one of the EBCDIC codesets where most of what Jim said above is not true.
Capital A is decimal 65 in ASCII, but it is decimal 193 in EBCDIC. Although in ASCII, the lowercase (uppercase) letters a-z (A-Z) have adjacent increasing values, that is not true in EBCDIC. The standards do, however, require that the 10 decimal digits (0-9) do have adjacent increasing values no matter what the underlying codeset is. When d is an integeral value from 0 through 9 inclusive, the following works to convert d to the corresponding character value in an ASCII based environment:
(note 48; not the 49 Jim listed above) the same conversion in an EBCDIC based environment would be:
But, you can portably write:
no matter what codeset underlies your C and POSIX Locales.
In ASCII, 'a' + 25 is 'z' and 'A' + 25 is 'Z'; that relationship does not hold in EBCDIC.
Note also that your system's default locale is chosen by your system's administrator and is frequently not the C Locale. However, when a C program enters main, it will be act as if it had made the call:
When a program capable of dealing with internationalized environments starts, it should explicitly make the call:
to set the locale in use to be the system's default locale (if the user hasn't overridden the default) or the locale specified by the user by setting the LANG and LC_* environment variables. And, obviously, the program should verify that the user didn't specify an invalid locale by checking the return code from that call to setlocale().
This User Gave Thanks to Don Cragun For This Post:
Hi Guys,
I was just wondering if anybody can help me with this problem.
OK, how we can get a value back from PL/SQL Script (not stored procedure/function)
See the below example: (for example aaa.sh)
#!/bin/ksh
VALUE=`sqlplus -s user/password@test_id <<EOF
@xxx.sq
EOF`
echo $VALUE
... (7 Replies)
hi all,
Can any 1 help me translate this korn shell code to C shell code :
email=$(grep "^$1" $folder/config_2.txt | awk '{print $2'})
In config_2.txt the content is :
which mean in korn shell , $1=groupname and $2=email address.
Now i need to write in C shell script,when i set the... (2 Replies)
Hi,
I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory.
finally {
if (null != hibernateSession && hibernateSession.isOpen()) {
//hibernateSession.close();
}
}
It would be great if the script has... (2 Replies)
Hi ,
I have a code where i am using a infinite while loop . some thing like below
while
do
if
then
#go to line 20
fi
command 1;
command 2;
#line 20:
sleep 34; (5 Replies)