I think the problem is still whether to use 'u' == UCS2 and 'w' == UCS4 like in PEP-3118.
For the project I'm currently working on I'd need these for buffer exports:
>>> from xnd import *
>>> x = xnd(["abc", "xyz"], dtype="fixed_string(10, 'utf16')")
>>> y = xnd(["abc", "xyz"], dtype="fixed_string(10, 'utf32')")
>>>
>>> memoryview(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: type is not supported by the buffer protocol
The use case is not an array that represents a single utf16 string, but
an array *of* fixed strings with different encodings.
So x would be exported with format 'u' and y with format 'w'. |