You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

According to C99, Section 5.2.1, "Character sets"

Two sets of characters and their associated collating sequences shall be defined: the set in which source files are written (the source character set), and the set interpreted in the execution environment (the execution character set). Each set is further divided into a basic character set, whose contents are given by this subclause, and a set of zero or more locale-specific members (which are not members of the basic character set) called extended characters. The combined set is also called the extended character set. The values of the members of the execution character set are implementation-defined.

The character encoding defined by the ASCII standard is the following: code values are assigned to characters consecutively in the order in which the characters are listed as the table below: starting from 32 (assigned to space) and ending up with 126 (assigned to the tilde character ~). Positions 0 through 31 and 127 are reserved for control codes.

 

!

"

#

$

%

&

'

(

)

*

+

,

-

.

/

0

1

2

3

4

5

6

7

8

9

:

;

<

=

>

?

@

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d53a8dbb-d601-472f-9632-be004ef50a3c"><ac:plain-text-body><![CDATA[

P

Q

R

S

T

U

V

W

X

Y

Z

[

\

]

^

_

]]></ac:plain-text-body></ac:structured-macro>

'

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

x

y

z

{

|

}

~


There are several national variants of ASCII. Therefore, the original ASCII is often referred as US-ASCII. The international standard ISO 646 defines a character set similar to US-ASCII, but with code positions corresponding to US-ASCII characters @[]{|}
as "national use positions". It also gives some liberties with characters #$^`~. In ISO 646, several "national variants of ASCII" have been defined, assigning different letters and symbols to the "national use" positions. Thus, the characters that appear in those positions - including those in US-ASCII are somewhat "unsafe" in international data transfer.

Thus, due to the "national variants" discussed above, some characters are less "safe" than others, for example, they might be transferred or interpreted incorrectly.

In Addition to the letters of the English alphabet ("A" to "Z" and "a" to "z"), the digits ("0" to "9") and the space , only the following characters can be regarded as really "safe" in data transmission:

 ! " % & ' ( ) * + , - . / : ; < = > ?

When naming files, variables, data files etc., it is often best to use only the characters listed above.

Comments

The way to resolve this issue is to use the corresponding codes strictly for US-ASCII meanings; national characters are handled otherwise, giving them their own, unique and universal code positions in character codes larger than ASCII. But certain old softwares and devices may still reflect various "national variants of ASCII".  

Risk Assessment


This issue will result data lost or data mis-interpretation during data transmission. This can be a serious security issue. There are already solutions which address this issue pretty well. (See "Comments" section)

Reference

http://www.cl.cam.ac.uk/~mgk25/unicode.html
ISO/IEC 646, Information technology ? ISO 7-bit coded character set for information
interchange.
C99, Section 5.2.1, "Character sets"

  • No labels