Created
December 21, 2018 17:21
-
-
Save david-batranu/1522acaae850a1cd78251e16dadba4f6 to your computer and use it in GitHub Desktop.
This file contains 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
#include <Python.h> | |
int main(int argc, char *argv[]) { | |
const char *s1 = "șustă"; | |
PyUnicodeObject *uo_s1 = PyUnicode_FromString(s1); | |
Py_ssize_t s_s1 = PyUnicode_GetSize(uo_s1); | |
Py_UNICODE *c_s1 = PyUnicode_AS_UNICODE(uo_s1); | |
printf("SUP!: %li\n", s_s1); | |
for (int i = 0; i < s_s1; i++) { | |
printf("%i: %c\n", i, c_s1[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment