public override void Write(byte[] buffer, int offset, int count)
{
String sKey = new String((sbyte[])buffer,offset, count); -- does not
compile. Can not convert byte[] to sbyte[].
}
Thanks.
George.
Did you tried BitConverter.ToString( byte[] ) ?
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"George Ter-Saakov" <w...@hotmail.com> wrote in message
news:%23R$NI8YOD...@TK2MSFTNGP11.phx.gbl...
Ronen
"George Ter-Saakov" <w...@hotmail.com> wrote in message
news:#R$NI8YOD...@TK2MSFTNGP11.phx.gbl...
You should use Encoding.GetString (byte[]) - but which encoding you
wish to use depends on the application. Is the data fundamentally text
data? If not, I would suggest not converting it into a string at all,
or using something like Base16 or Base64. If it is, you will hopefully
know the encoding.
See http://www.pobox.com/~skeet/csharp/unicode.html for more
information.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
You can use ASCIIEncoding.GetString( byte[] ) for that.
Sorry for the first post
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:OAi6cBZO...@TK2MSFTNGP11.phx.gbl...
System.IO.MemoryStream s = new MemoryStream(buffer, offset, count);
System.IO.StreamReader read = new StreamReader(s);
stsring sKey = read.ReadToEnd();
Hope this works for you.
Chris
"George Ter-Saakov" <w...@hotmail.com> wrote in message
news:#R$NI8YOD...@TK2MSFTNGP11.phx.gbl...
Well, that's just as wrong if the data isn't originally in ASCII :)
It really depends what the data really *is*...
And I can not use any other format since that filter looks for tokens (given
as strings) and substitutes them with special phrases. So somehow I need to
convert bytes back to the string to match it against tokens.
Thanks.
George.
"Jon Skeet" <sk...@pobox.com> wrote in message
news:MPG.196119714...@news.microsoft.com...
Yikes, that seems a longwinded way of doing:
string sKey = Encoding.UTF8.GetString (buffer, offset, count);
:)
"Chris Capel" <as...@asdf.com> wrote in message
news:etzk7HZO...@TK2MSFTNGP10.phx.gbl...
Chris
"gerry" <ge...@hotmail.com> wrote in message
news:es5asyaO...@tk2msftngp13.phx.gbl...
> Thanks to everyone.
> I am writing a filter for HttpResponse so my guess I should use
> System.Text.Encoding.UTF8
Well, don't guess -- check it out ;-)
Encoding encoding = Response.ContentEncoding;
Cheers,
--
Joerg Jooss
joerg...@gmx.net