Created
March 10, 2025 03:18
-
-
Save tonycoz/ab8a0c982c5e2376be671d21c00bc8d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\Tony\dev\perl\git>type mbsurr.c | |
#include <windows.h> | |
#include <stdio.h> | |
#include <string.h> | |
char mbcs[] = "\xED\xA0\x81"; // D801 | |
int main() { | |
wchar_t out[20]; | |
int len = MultiByteToWideChar(CP_UTF8, 0, mbcs, strlen(mbcs), out, 20); | |
printf("len %d error %lu\n", len, (unsigned long)GetLastError()); | |
for (int i = 0; i < len; ++i) { | |
printf("%04x\n", out[i]); | |
} | |
} | |
C:\Users\Tony\dev\perl\git>cl mbsurr.c | |
Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for x64 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
mbsurr.c | |
Microsoft (R) Incremental Linker Version 14.43.34808.0 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
/out:mbsurr.exe | |
mbsurr.obj | |
C:\Users\Tony\dev\perl\git>mbsurr | |
len 2 error 0 | |
fffd | |
fffd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment