#89 wcstou8s and u8towc incorrect for zero-length source strings

open
nobody
None
5
2005-04-25
2005-04-25
No

A zero-length source string which consist of the null
terminating character should result in a zero-length
destination string which consist of the null
terminating character.

However, these functions return without setting the
null character in the destination string.

E.g.
If I have the following code:

wchar_t* src = L"\0";
char dest[4];
dest[0] = 'b'; dest[1] = 'a'; dest[2] = 'd';
dest[3] = '\0';
wcstou8s(dest, src, 1);
printf("Result: '%s'\n", dest);

the output I get is
Result: 'bad'

The output should be
Result: ''

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks