This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/81114] GNAT mishandles filenames with UTF8 chars on case-insensitive filesystems
- From: "simon at pushface dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Jul 2017 19:53:46 +0000
- Subject: [Bug ada/81114] GNAT mishandles filenames with UTF8 chars on case-insensitive filesystems
- Auto-submitted: auto-generated
- References: <bug-81114-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81114
--- Comment #3 from simon at pushface dot org ---
Just for interest, this not-very-good code will successfully convert
the uppercase-a-acute input c381 to uppercase-a/combining-acute 41cc81:
#include <stdio.h>
#include <iconv.h>
#include <stdint.h>
#include <memory.h>
int main(void)
{
uint8_t codepoint[] = {0xc3, 0x81, 0};
char *input = (char *) &codepoint;
size_t in_size = 2;
char output_buffer[10];
memset(output_buffer, 0, sizeof(output_buffer));
char *output = output_buffer;
size_t out_size = 10;
iconv_t cd = iconv_open("utf8-mac", "UTF-8");
iconv(cd, &input, &in_size, &output, &out_size);
printf("in %d out %d result \"%s\"\n", in_size, out_size, output_buffer);
return 0;
}
but of course only on macOS - https://stackoverflow.com/a/23159081/40851