PyUnicodeUCS4_EncodeDecimal

Takes a Unicode string holding a decimal value and writes it into an output buffer using standard ASCII digit codes.

The output buffer has to provide at least length+1 bytes of storage area. The output string is 0-terminated.

The encoder converts whitespace to ' ', decimal characters to their corresponding ASCII digit and all other Latin-1 characters except \0 as-is. Characters outside this range (Unicode ordinals 1-256) are treated as errors. This includes embedded NULL bytes.

Error handling is defined by the errors argument:

NULL or "strict": raise a ValueError "ignore": ignore the wrong characters (these are not copied to the output buffer) "replace": replaces illegal characters with '?'

Returns 0 on success, -1 on failure.

  1. int PyUnicodeUCS4_EncodeDecimal(Py_UNICODE* s, Py_ssize_t length, char* output, const(char)* errors)
    version(!Python_Unicode_UCS2)
    int
    PyUnicodeUCS4_EncodeDecimal
    ()
  2. alias PyUnicode_EncodeDecimal = PyUnicodeUCS4_EncodeDecimal

Meta