Skip to content

Instantly share code, notes, and snippets.

@dmilith
Created December 12, 2020 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmilith/5d0d19e46b1407b1460bfd7c7d00e8ac to your computer and use it in GitHub Desktop.
Save dmilith/5d0d19e46b1407b1460bfd7c7d00e8ac to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stddef.h>
#include <wchar.h>
#include <locale.h>
int main () {
//const wchar_t* wc = L'👌';
const char* wc = L"👌";
int length = wcswidth(wc, 1);
setlocale(LC_ALL, "en_US.UTF-8");
printf(L"%lc, length: %d\n", wc, length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment