non-ASCII filepaths in a C function

Henning Thielemann <[email protected]> Fri, 24 Jul 2015 23:52:35 +0200 (CEST)
Newsgroups gmane.comp.lang.haskell.libraries,gmane.comp.lang.haskell.ffi
Message-ID <alpine.DEB.2.02.1507242344260.7190@sputnik>
In my 'soxlib' package I have written a binding to

sox_format_t * sox_open_read(
     char               const * path,
     sox_signalinfo_t   const * signal,
     sox_encodinginfo_t const * encoding,
     char               const * filetype);


I construct the C filepath "path" from a Haskell FilePath using 
Foreign.C.String.withCString. This works for ASCII and non-ASCII 
characters in Linux. However, non-ASCII characters let sox_open_read fail 
on Windows. What is the correct way to convert FilePath to "char *"?