I'm reading a socket stream and converting the byte array to a single string in both Java & C#, but the results are different...
C# code:
string text = Encoding.Default.GetString(ms.ToArray());
Java code:
String text = new String(data);
One of the potential issues I encountered upon research was that C#'s default encoding was UTF-32 & Java's was UTF8, as well as C# uses little endian and Java uses Big endian, so the solution would be to define charset in java as UTF-32LE but even then it returns entirely different to C# and most if not all of the string is a combination of �
Just as extra information regarding my methods in Java I'm using ByteArrayOutputStream to store data from DataInputStream & in C# I'm using MemoryStream to store data from NetworkStream
Encoding.Defaultis UTF-32? That seems like a strange default, since no Windows system uses that normally. Perhaps you should print outEncoding.Default, and/or examine the actual bytes indataon the Java side?