NETMF / llilum

Development Platform for MSIL and UWP apps targeting Micro Controllers. Part of the .NET Micro Framework family.
Other
159 stars 52 forks source link

UTF8 Decoding from byte[] produces incorrect string length #153

Closed ZachNL closed 8 years ago

ZachNL commented 8 years ago

The VanillaRead IO test in the NETMF test set fails because the following code generates a string with an incorrect length. The string itself looks correct, but the length is too long.

string testResult = new string(Encoding.UTF8.GetChars(readbuff));

The offending function appears to be: internal override unsafe int GetCharCount( byte* bytes , int count , DecoderNLS baseDecoder ) in file UTF8Encoding.cs

ZachNL commented 8 years ago

This looks to be a test issue. The UTF8 string was read into a buffer that was larger than the read required. And the number of actual bytes read was not used when decoding the bytes. The tests will be updated shortly.