[Python-Dev] C code: %s vs %U

Victor Stinner victor.stinner at gmail.com
Wed Mar 26 12:46:23 CET 2014


2014-03-26 12:02 GMT+01:00 Antoine Pitrou <solipsis at pitrou.net>:
> Ok, I suppose it's PyUnicode_Format? :-)

I don't think that PyUnicode_Format supports %U.

For PyUnicode_FromFormatV(), %U expects a Python Unicode object,
whereas "%s" expects a ASCII (or latin1?) encoded byte string "const
char*".

For PyArg_ParseTuple, "s" accepts str and bytes and encodes str to
UTF-8, whereas "U" expects str.

Victor


More information about the Python-Dev mailing list