Most UNIX APIs work in UTF-8, not UTF-16. Rather than having to write wrappers that encode/decode UTF-8 and run ByteString's packCString and useAsCString functions (and the corresponding ...Len variants), please consider providing these functions directly in either Data.Text.Foreign or Data.Text.Encoding. Such wrappers would make c2hs bindings easier to write.
Happy to consider this, if you've an idea of what the APIs should specifically look like.
Same type signatures as peekCString and withCString, using the CString type, but accepting/producing UTF-8 respectively.
Implement peekCStringLen and withCStringLen (gh-32)
That commit added the Len variants, but not the peekUTF8CString and withUTF8CString functions needed to work with the much more common NUL-terminated UTF-8. Could you please add that pair of functions as well?