Click here to Skip to main content
15,908,175 members
Home / Discussions / C#
   

C#

 
AnswerRe: BindingNavigator Problem Pin
Paul Conrad25-Nov-07 9:17
professionalPaul Conrad25-Nov-07 9:17 
GeneralRe: BindingNavigator Problem Pin
Xmen Real 25-Nov-07 15:13
professional Xmen Real 25-Nov-07 15:13 
QuestionVisual Studio 2008 Training Kit Pin
Peter Vertes24-Nov-07 16:50
Peter Vertes24-Nov-07 16:50 
AnswerRe: Visual Studio 2008 Training Kit Pin
Paul Conrad25-Nov-07 9:17
professionalPaul Conrad25-Nov-07 9:17 
QuestionRendering SVG in C# Pin
AbXorb24-Nov-07 13:00
AbXorb24-Nov-07 13:00 
AnswerRe: Rendering SVG in C# Pin
Christian Graus24-Nov-07 14:06
protectorChristian Graus24-Nov-07 14:06 
GeneralRe: Rendering SVG in C# Pin
AbXorb25-Nov-07 0:38
AbXorb25-Nov-07 0:38 
GeneralDisplaying a ASN.1 BMP (Basic Multilingual Plane) String Pin
Jeffrey Walton24-Nov-07 12:33
Jeffrey Walton24-Nov-07 12:33 
Hi All,

I wanted to share this with anyone who may stumble across this thread.

X.690 specifies a BMP string is the 2-octet canonical form (specified in ISO/IEC 10646-1) [1] of UCS (also specified in ISO/IEC 10646-1) [2]. Note that ASN.1 does not include an "Endianness" marker in its octet stream [3].

ISO 10646 prefers Big Endianness, though it is not standardized [4]. According to Microsoft, CodePage 1200 is Unicode (UTF-16), and CodePage 1201 is Unicode Big Endian (16 bits also)[5].

In memory, the byte[] from the ASN.1 sequence is [00 77 00 105 00 99 00 114 00 111 00 115 00 111 00 102 00 116 ...]. This is a Big Endian Serialization [6] from Microsoft's Cryptograhic Service Provider.

When interpreted as Unicode, I receive a non printable string. When interpreted as Big Endian Unicode (CodePage 1201), I receive 'Microsoft'.

So, a test of byte[] (Value[0]) is required to properly return the string. The return will be either Encoding.GetEncoding(1200).GetString(Value); or Encoding.GetEncoding(1201).GetString(Value).

Simply using Encoding.Unicode does not produce expected results in every case, since Unicode implies Little Endianness when using C#.

Jeff

[1] ITU X.690, p. 16, Section 8.21.8
[2] ITU X.690, p. 16, Section 8.21.9
[3] ITU X.690, p. 16, Section 8.21.9. Note 2b.
[4] ISO-10646, Section 6.3
[5] EncodingInfo Class[^]
[6] RFC 2781, Section 3.1
QuestionDirectSound Error Pin
MasterSharp24-Nov-07 12:03
MasterSharp24-Nov-07 12:03 
AnswerRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 12:35
professionalRavi Bhavnani24-Nov-07 12:35 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 12:37
MasterSharp24-Nov-07 12:37 
AnswerRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 12:39
professionalRavi Bhavnani24-Nov-07 12:39 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 12:39
MasterSharp24-Nov-07 12:39 
GeneralRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 12:41
professionalRavi Bhavnani24-Nov-07 12:41 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 12:42
MasterSharp24-Nov-07 12:42 
GeneralRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 12:44
professionalRavi Bhavnani24-Nov-07 12:44 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 12:51
MasterSharp24-Nov-07 12:51 
GeneralRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 12:54
professionalRavi Bhavnani24-Nov-07 12:54 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 12:58
MasterSharp24-Nov-07 12:58 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 13:02
MasterSharp24-Nov-07 13:02 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 13:04
MasterSharp24-Nov-07 13:04 
GeneralRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 13:06
professionalRavi Bhavnani24-Nov-07 13:06 
AnswerRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 13:03
professionalRavi Bhavnani24-Nov-07 13:03 
GeneralRe: DirectSound Error Pin
MasterSharp24-Nov-07 13:05
MasterSharp24-Nov-07 13:05 
GeneralRe: DirectSound Error Pin
Ravi Bhavnani24-Nov-07 13:07
professionalRavi Bhavnani24-Nov-07 13:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.