Reputation: 16290
I've checked other SO answers, but none seems to work in my particular case.
I'm retrieved the value as follows:
byte[] bytBLOB = new byte[reader.GetBytes(1, 0, null, 0, int.MaxValue) - 1];
reader.GetBytes(1, 0, bytBLOB, 0, bytBLOB.Length);
var value = Encoding.Default.GetString(bytBLOB);
However the value is: e\0n\0_\0U\0S
when it should be just en_us
.
How can I convert it properly?
Upvotes: 1
Views: 2646
Reputation: 2554
Probably the blob is encoded in UTF-16. Then something like this could happen.
Try:
var value = Encoding.GetEncoding("UTF-16").GetString(bytBLOB);
Upvotes: 1