4.3 NSC File Encoding

 The following represents the content of an .nsc file in which all strings use ASCII characters, and thus are not encoded:

 [Address]
 Name=MY_COMPUTER, bpp 
 NSC Format Version=3.0
 Multicast Adapter=157.55.149.102
 IP Address=239.192.48.179
 IP Port=0x00004A41
 Time To Live=0x00000020
 Default Ecc=0x0000000A
 Log URL=                                
 Unicast URL=
 Allow Splitting=0x00000001
 Allow Caching=0x00000001
 Cache Expiration Time=0x00015180
 Network Buffer Time=0x000001F4
 [Formats]
 Format1=<ASF header 1>
 Description1=Windows Media Audio Stream

Below is the same file in which all strings originated as Unicode character strings and were subsequently encoded into ASCII characters:

  
 [Address]
 Name=029W000000000YJG1P05y0Gm1F04q0K01L05G0HG1I02m0801Y0700S00000
 NSC Format Version=029G0000000008Cm0k0300000
 Multicast Adapter=0230000000000UCG0r03S0BW0r03K0BW0n03G0E
 G0k0340C00o0000
 IP Address=020G000000000UCW0p03a0BW0n03a0CW0k03G0E00k0340Dm0v0000
 IP Port=0x00004A41
 Time To Live=0x00000020
 Default Ecc=0x0000000A
 Log URL=020W0000000002000
 Unicast URL=020W0000000002000
 Allow Splitting=0x00000001
 Allow Caching=0x00000001
 Cache Expiration Time=0x00015180
 Network Buffer Time=0x000001F4
 [Formats]
 Format1=02X0000vu000EfC2QoTOvcpn6csG2g06BER7S30000000020000042p
 dNu...
 Description1=029m000000000SLm1f06u0P01l07S0Sm0W04q0PG1a06a0OG0000

The following diagrams and descriptive text further illustrate the encoding of Unicode character strings into ASCII characters, as specified in section 2.2.1.3.2. The fields in the EncodedDataHeader (section 2.2.1.3.1) structure to be encoded and their endian arrangement are shown in the following diagram.

Unicode character string encoding

Figure 3: Unicode character string encoding

Consider the NSC Format Version property from the preceding .nsc file example. If the value "3.0" that is associated with the property is expressed as a Unicode string, the following bit array would result for the EncodedDataHeader structure. For the byte order of the Unicode characters, see section 2.2.1.2.

Unicode string

Figure 4: Unicode string

Using the encoding algorithm (as specified in section 2.2.1.3.2), the bits in the array are grouped and converted into 6-bit numbers, as illustrated in the diagram below. The decimal equivalent of each 6-bit number, and the corresponding ASCII character from the encoding table are shown above each group in the diagram.

Note that the bit array that is shown is not evenly divisible by six; two zero-value bits (shown with hash marks) are added to the final group to yield a 6-bit group.

Bit array

Figure 5: Bit array

As specified in section 2.2.1.1, the resulting ASCII character string is preceded with "02"; therefore, the property and Unicode-based string NSC Format Version=3.0 is encoded and transformed to become NSC Format Version=029G0000000008Cm0k0300000.