K
KrippZ
Hello!
We here at the office have discovered something odd. Can somebody
please verify this potential bug for us?
This code generates a byte buffer fills it with 256 bytes ranging from
0 to 255, and the bug appers when the Unicode Encoder gets the bytes
from another Unicode Encoder that gives it a string from a bytebuffer.
The bytebuffers should not differ but in Net 2.0 they do.
We have run the testcode in VS 2003 and VS 2005 and the results of
2003 don´t differ.
bytes 216,217 and 222, 223 seem to go missing?!?
static void Main(string[] args)
{
byte[] bytearrBuffer = new byte[256];
for (int i = 0; i < 256; i++)
{
bytearrBuffer = (byte)i;
}
WriteBuffer(bytearrBuffer, "Buffer.txt");
WriteBuffer(new System.Text.UnicodeEncoding().GetBytes(new
System.Text.UnicodeEncoding().GetString(bytearrBuffer)),
"Buffer2.txt");
}
public static void WriteBuffer(byte[] arrbyteBuffer, string
filename)
{
try
{
string sLogFileName = Path.Combine("c:\\", filename);
FileStream fs = new
FileStream(sLogFileName,FileMode.Create,FileAccess.Write,FileShare.Write);
BinaryWriter bw = new BinaryWriter(fs);
for (int i = 0; i < arrbyteBuffer.Length; i++)
{
bw.Write(arrbyteBuffer.ToString());
}
bw.Flush();
bw.Close();
}
catch
{
}
}
Cheers
//KrippZ
We here at the office have discovered something odd. Can somebody
please verify this potential bug for us?
This code generates a byte buffer fills it with 256 bytes ranging from
0 to 255, and the bug appers when the Unicode Encoder gets the bytes
from another Unicode Encoder that gives it a string from a bytebuffer.
The bytebuffers should not differ but in Net 2.0 they do.
We have run the testcode in VS 2003 and VS 2005 and the results of
2003 don´t differ.
bytes 216,217 and 222, 223 seem to go missing?!?
static void Main(string[] args)
{
byte[] bytearrBuffer = new byte[256];
for (int i = 0; i < 256; i++)
{
bytearrBuffer = (byte)i;
}
WriteBuffer(bytearrBuffer, "Buffer.txt");
WriteBuffer(new System.Text.UnicodeEncoding().GetBytes(new
System.Text.UnicodeEncoding().GetString(bytearrBuffer)),
"Buffer2.txt");
}
public static void WriteBuffer(byte[] arrbyteBuffer, string
filename)
{
try
{
string sLogFileName = Path.Combine("c:\\", filename);
FileStream fs = new
FileStream(sLogFileName,FileMode.Create,FileAccess.Write,FileShare.Write);
BinaryWriter bw = new BinaryWriter(fs);
for (int i = 0; i < arrbyteBuffer.Length; i++)
{
bw.Write(arrbyteBuffer.ToString());
}
bw.Flush();
bw.Close();
}
catch
{
}
}
Cheers
//KrippZ