The EDA filter converts characters in a document to the UN/EDIFACT Syntax Level
A character set. This character set contains 56 characters, but the
following are excluded for use in the encoding:
The characters used for delimiters, separators or terminators: colon (:),
apostrophe ('), plus (+), and question mark (?) .
The characters that cannot be used internationally for telex transmission:
exclamation mark (!), quotation mark (\), percent sign (%), ampersand (&),
asterisk (*), semi-colon (;), less-than sign (<), and greater-than sign
(>).
In addition, the space is not used as a character to map. This leaves 43
characters.
The following table is the Syntax Level A character set. The characters
colored are those excluded in the encoding.
Character
Description
Notes
1
.
Full Stop
2
,
Comma
3
-
Hyphen
4
(
Open Parenthesis
5
)
Close Parenthesis
6
/
Oblique Stroke
7
=
Equal
8
SP
Space
9
!
Exclamation Mark
Telex Transmission
10
"
Quotation Mark
Telex Transmission
11
%
Percent
Telex Transmission
12
&
Ampersand
Telex Transmission
13
*
Asterisk
Telex Transmission
14
;
Semi Colon
Telex Transmission
15
<
Less Than Sign
Telex Transmission
16
>
Greater Than Sign
Telex Transmission
17
:
Colon
Used for Sub Element Separator
18
'
Apostrophe
Used for Segment Terminator
19
+
Plus
Used for Element Terminator
20
?
Question Mark
Used for Release Indicator
21 - 30
0 1 2 3 4 5 6 7 8 9
All Numbers
31 - 56
A B C D E F G H I J K L M N O PQ R S T U V W X Y Z
All Upper Case Alphabets
Encoding
The procedure for encoding is as follows:
The data is subdivided into 2 byte pairs. For documents having an
uneven count of bytes, the last byte will not be paired.
For each pair, 3 numbers are generated from its decimal value to
represent the pair. This is done as follows:
The first number is the result of dividing the 2 byte decimal value by 1849
(43^2).
The second number is the result of dividing the remainder (modulo) of step 1 by
43.
The third number is the result of the remainder (modulo) of step 2.
Example. The 3 number representation for the two byte value
0xAD 0xFF is 24, 3, and 38. The decimal value of 0xADxFF is 44543,
and the calculation is as follows:
44543 divide by 1849 is 24.
44543 modulo 1849 is 167; 167 divide by 43 is 3.
167 modulo 43 is 38.
If there is an unmatched single byte at the end of the document then 2 numbers
are generated:
The first number is the result of dividing the one byte decimal value by
43.
The second number is the result of the remainder of step 1.
Example. The 2 number number representation for the one byte value 0xBC
is 4 and 16. The decimal value of 0xBC is 188, and the calculation is as
follows:
188 divide by 43 is 4.
188 modulo 43 is 16.
The generated 3 or 2 numbers are then mapped to the following table
to generate their corresponding 3 or 2 encoded characters:
Map Table.
Number
Encoded Char
00
0
01
1
02
2
03
3
04
4
05
5
06
6
07
7
08
8
09
9
10
A
11
B
12
C
13
D
14
E
15
F
16
G
17
H
18
I
19
J
20
K
21
L
Number
Encoded Char
22
M
23
N
24
O
25
P
26
Q
27
R
28
S
29
T
30
U
31
V
32
W
33
X
34
Y
35
Z
36
(
37
)
38
,
39
-
40
.
41
/
42
=
Example. The 3 character representation for the two byte value
0xAD 0xFF is "O3,". The decimal value of 0xADxFF is 44543, and the
calculation is as follows:
44543 divide by 1849 is 24. The number 24 maps to "O".
44543 modulo 1849 is 167; 167 divide by 43 is 3. The
number 3 maps to "3".
167 modulo 43 is 38. The number 38 maps to "," (comma).
Decoding
The procedure for decoding is as follows:
For each encoded character in the document, using the map table convert
the character to its corresponding number ranging from 0 to 42. Note that
a properly encoded document will only contain characters shown on the right
side of the map.
Subdivide the stream of numbers in 3 sets, and for each set, generate a
2-byte decimal value using the following formula:
(N1 * 1849) + (N2 * 43) + N3
Multiply the first number in the set with 1849 (43^2).
Multiply the second number in the set with 43.
Add the third number with the products calculated in step 1 and 2.
If the last bytes only make up a set of 2, then generate a 1-byte
decimal value using the formula:
(N1 * 43) + N2
Multiply the first number in the set with 43.
Add the second number with the product calculated in step 1.
Example
For example to encode the string "The 5 men of 223rd St" using
EDA filter, the byte stream would be as follows: