Joerg
Tue Nov 29 16:32:37 CST 2005
Arne wrote:
> Joerg Jooss,
> The Microsoft way
> Dim e37 As Encoding
> Dim ascii As Encoding
> e37 = Encoding.GetEncoding(37)
> ascii = Encoding.ASCII
> Dim asciiBytes As Byte() = Encoding.Convert(e37, ascii, encoded)
> Dim asciiChars(ascii.GetCharCount(asciiBytes, 0,
> asciiBytes.Length)) As Char
> ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0)
> buf = New String(asciiChars)
>
> The Jon way
> Dim ebc As EbcdicEncoding
> ebc = EbcdicEncoding.GetEncoding("EBCDIC-US")
> buf = ebc.GetString(encoded)
>
> Is there an easier way?
There's no MS way, nor is there a Jon way. All implementations are
derived from the base class System.Text.Encoding, thus you can use
GetString() in the first example as well.
Cheers,
--
http://www.joergjooss.de
mailto:news-reply@joergjooss.de