none
Encoding String To UTF16 Little Endian RRS feed

Answers

  • strings are unicode by default, you can get a byte array of the string in UTF16 by using System.Text.Encoding.Unicode.GetBytes
    • Marked as answer by demipaul Monday, October 27, 2008 5:14 PM
    Monday, October 27, 2008 3:09 AM

All replies

  • strings are unicode by default, you can get a byte array of the string in UTF16 by using System.Text.Encoding.Unicode.GetBytes
    • Marked as answer by demipaul Monday, October 27, 2008 5:14 PM
    Monday, October 27, 2008 3:09 AM
  • It seems this is what you should do.

                    byte[] number = new byte [2];  
                    number[0] = 87;  
                    number[1] = 145;  
                    Array.Reverse ( number ); 

    AlexB
    Monday, October 27, 2008 3:31 AM
  • AlexBB said:

    It seems this is what you should do.

                    byte[] number = new byte [2];  
                    number[0] = 87;  
                    number[1] = 145;  
                    Array.Reverse ( number ); 

    AlexB



     Gehh you entirely sure you are responding to the correct thread? :)
    Monday, October 27, 2008 3:41 AM
  •  Thank you all for your reply. And thank you for you clarification. Although, I think reversing the byte order (from biggest to smallest) would make it UTF-16 (Unicode) Big Endian, and I need Little Endian.
    Monday, October 27, 2008 5:14 PM
  • Ray M_ said:


     Gehh you entirely sure you are responding to the correct thread? :)

    That was goofy, I agree. I was responding to the correct thread though. He should do bit arithmetic, unless a built-in method is found. I can easily write a method if the OP wants.


    AlexB
    Monday, October 27, 2008 5:20 PM