> I have a doubt about PER encoding (Aligned) of
> CharacterStrings. For example:
>
> a PrintableString::= "A"
> Value 'a' would be encoded to
> 1) 65 in 8 bits or
> 2) 22 in 7 bits. According to the table 5 in X.680 and
> to chapter 26 in X.691 all chars would be encoded in 7
> bits (74 characters in table) and "A" would have the
> index 22.
> 3) 22 in 8 bits (because of the alignment variant). In
> this case there is no advantage using index!
I presume you mean 65 in decimal (41 in hex). If so, the answer is 1.
Character strings in aligned PER do not encode into 7 bit characters.
They may only encode into powers of 2 bits (for example, 8 bits or
4 bits, but not 6 or 7 bits). Thus, although PrintableString has only
74 possible states, it would still need 8 bits, not 7. Further, even
if 7 bits were permissible, since the largest possible value fits
within 7 bits, there would be no need for indexing, so your answers
2 and 3 are clearly wrong.
Permit me to present some examples:
1. AllCharacters ::= PrintableString
s AllCharacters ::= "ABCD"
would encode to 0441424344 in Aligned PER,
with 04 being the length, and 41424344 being the value.
2. OnlyAThroughZ ::= PrintableString (FROM ("A".."Z"))
s OnlyAThroughZ ::= "ABCD"
would also encode to 0441424344 in Aligned PER
Although restricted to the characters from A through Z, there
are still 26 possible states, meaning 5 bits would be needed to
represent all states. But in Aligned PER, we need to go to the
next power of 2, namely, 8, so there we are at 8 bits again.
3. OnlyAThroughP ::= PrintableString (FROM ("A".."P"))
s OnlyAThroughP ::= "ABCD"
would encode to 040123 in Aligned PER
In this case, there are only 16 possible states, perfect as a
power of 2, so Aligned PER uses 4 bits per character. Further,
since the value for P is greater than 15, the encoded
characters must be indexed, namely,
0 A
1 B
2 C
3 D
4 E
5 F
6 G
7 H
8 I
9 J
A K
B L
C M
D N
E O
F P
Thus "ABCD" transforms to 0123.
Everything above deals with ALIGNED PER. If you were to instead
use Unaligned PER, you could efficiently encode a 7 bit character set.
I won't discuss Unaligned PER further at this point, unless you ask
me to.
=====================================================================
Conrad Sigona Toll Free : 1-888-OSS-ASN1
OSS Nokalva Voice Mail : 1-732-302-9669 x400
[EMAIL PROTECTED] Fax : 1-419-831-5035
http://www.oss.com My direct line : 1-315-845-1773