Re: How to Convert byte[] to String ? {simple request}

From: Morten Wennevik (MortenWennevik_at_hotmail.com)
Date: 06/03/04


Date: Thu, 03 Jun 2004 19:27:26 +0200

Hi Nate,

As Patrick said, the bytes need to be filtered through some encoding before they would make sense. ASCII, Unicode, UTF-8, etc. Reading a string as a set of ascii characters would cause a mess if the bytes were unicode encoded.
The Encoding classes have a GetString method you can use.

Happy coding!
Morten Wennevik [C# MVP]



Relevant Pages

  • Re: eval and unicode
    ... encoding your terminal/file/whatnot is written in. ... you have a byte string that starts with u, then ", then something ... The first item in the sequence is \u5fb9 -- a unicode code point. ...
    (comp.lang.python)
  • Ruby, Unicode - ever?
    ... Why can't ruby use at least ICU libs? ... proper Unicode support, don't try to cheat me, that it's OK and enough, ... Ruby String class in current state is TOO MUCH OVERLOADED: ... encoding is senseless - this is plain bit stream. ...
    (comp.lang.ruby)
  • Re: Why asci-only symbols?
    ... >> Perhaps string equivalence in keys will be treated like numeric equivalence? ... I know typewill be and in itself contain no encoding information now, ... >and a Unicode string, the system default encoding ...
    (comp.lang.python)
  • Re: Attention: European C/C++/C#/Java Programmers-Call for Input
    ... and strings in Unicode - many modern languages allow it. ... proprietary half-baked encoding that is incompatible with every other tool ... tools for this new language whose codes will never be seen by its users. ... the effective string length is 1.0x or rare ...
    (comp.arch.embedded)
  • Re: str() should convert ANY object to a string without EXCEPTIONS !
    ... In any case, even if the ASCII encoding used all 256 possible bytes, you ... Your unicode string is a single character with ...
    (comp.lang.python)