Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Windows filenames and Unicode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <Jerome.Vouillon@p...>
Subject: Re: [Caml-list] Windows filenames and Unicode
On Wed, Sep 29, 2010 at 05:26:52PM +1000, Paul Steckler wrote:
> For Linux, I was planning on enforcing the invariant that all
> strings inside my program are UTF-8.  For Windows, I could use the
> same invariant, and modify the OCaml runtime so that all calls to
> Windows file primitives have those strings translated to UTF-16 (and
> return values translated back to UTF-8).  That is, I'd have to build
> a custom version of OCaml and wrap CreateFile, etc. with such
> Unicode translation functions.

The Unison file synchronizer (
has binding for the UTF-16 Windows API.  You should have a look at it.
At the moment, this is fairly tied to Unison (in particular because we
want to still be able to access the 8bit API for compatibility with
previous versions of Unison), but it would be great to turn the code
into a standalone library.  One possibility would be to write a
Unicode version of the Unix library.

> All this is made slightly more complicated by the fact that I'm using
> the MinGW version of OCaml.

There is no difficulty accessing the UTF-16 Windows API with MinGW
version of OCaml.  Actually, I'm even crosscompiling from Linux
without any difficulty.

-- Jerome