Is there a way to get the length in bytes of a CFString
given an arbitrary character encoding? It seems possible because the function CFStringGetSmallestEncoding
must do some calculations already, but I don't want to use the smallest encoding, I want to find out how big a buffer I might need to allocate if I want the bytes in UTF-8 encoding or maybe another variable-width character encoding.
Is it possible? Or do I need to allocate the maximum possible buffer size using CFStringGetMaximumSizeForEncoding
?