[PATCH] D55746: [libcxx] [test] [re.traits] Correct expected values for invalid UTF-8

Michał Górny via Phabricator reviews at reviews.llvm.org
Mon Dec 17 10:25:45 PST 2018


mgorny added a comment.

In D55746#1333210 <https://reviews.llvm.org/D55746#1333210>, @mclow.lists wrote:

> [ It's also possible that different implementations of the locales (part of the C library/OS) are returning different values. If that turns out to be the case, then we should document those differences and move on. ]


I think that's the case. I've written a simple test program to check it. Could you try it on Darwin?

  #include <ctype.h>
  #include <locale.h>
  #include <stdio.h>
  
  int main() {
  	unsigned char c = 0xDA, o;
  
  	/* verify with C locale */
  	setlocale(LC_ALL, "C");
  	o = tolower(c);
  	printf("C locale: %02x (%c) -> %02x (%c)\n", c, c, o, o);
  
  	/* ISO-8859-1 */
  	setlocale(LC_ALL, "en_US.ISO-8859-1");
  	o = tolower(c);
  	printf("iso-8859-1 locale: %02x (%c) -> %02x (%c)\n", c, c, o, o);
  
  	/* UTF-8 locale */
  	setlocale(LC_ALL, "en_US.UTF-8");
  	o = tolower(c);
  	printf("utf-8 locale: %02x (%c) -> %02x (%c)\n", c, c, o, o);
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55746/new/

https://reviews.llvm.org/D55746





More information about the libcxx-commits mailing list