From lemming at henning-thielemann.de Fri Jul 24 21:52:35 2015 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Fri, 24 Jul 2015 23:52:35 +0200 (CEST) Subject: non-ASCII filepaths in a C function Message-ID: 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 *"? From malcolm.wallace at me.com Sat Jul 25 07:40:59 2015 From: malcolm.wallace at me.com (Malcolm Wallace) Date: Sat, 25 Jul 2015 08:40:59 +0100 Subject: non-ASCII filepaths in a C function In-Reply-To: References: Message-ID: I believe the native representation for FilePaths on Windows should be UTF16 strings. Regards, Malcolm > On 24 Jul 2015, at 22:52, Henning Thielemann wrote: > > > 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 *"? > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries From lemming at henning-thielemann.de Sat Jul 25 08:05:35 2015 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Sat, 25 Jul 2015 10:05:35 +0200 (CEST) Subject: non-ASCII filepaths in a C function In-Reply-To: References: Message-ID: On Sat, 25 Jul 2015, Malcolm Wallace wrote: > I believe the native representation for FilePaths on Windows should be UTF16 strings. Btw. I don't think that soxlib expects UTF16 filepath strings on Windows because it works for purely ASCII filepaths.