Should mbrtowc(&wc, "", 1, &ps) set wc?

Apparently it does with glibc-2.1 and with Bruno's libutf8, but it
doesn't with glibc-2.2 (from CVS a few days ago).

Program:

#include <locale.h>
#include <stdio.h>
#include <wchar.h>

int main()
{
  mbstate_t ps;
  size_t r;
  wchar_t wc = 333;

  setlocale(LC_ALL, "");

  memset(&ps, 0, sizeof(ps));
  r = mbrtowc(&wc, "a", 1, &ps);
  printf("%d %d\n", r, (int)wc);
  r = mbrtowc(&wc, "", 1, &ps);
  printf("%d %d\n", r, (int)wc);

  return 0;
}

Result with glibc-2.1 or libutf8:

1 97
0 0

Result with glibc-2.2:

1 97
0 97

Edmund
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to