Version française
Home     About     Download     Resources     Contact us    
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: Paul Steckler <steck@s...>
Subject: Re: [Caml-list] Windows filenames and Unicode
On Wed, Sep 29, 2010 at 4:23 PM, David Allsopp <dra-news@metastack.com> wrote:
> A way (but not foolproof on Windows 7 and Windows 2008 R2 because you can disable it) would be to wrap the GetShortPathName Windows API function[1] which will convert the pathname to its DOS 8.3 format which will not contain Unicode characters. Another way might be to wrap the Unicode version of CreateFileEx and convert the result into a handle compatible with the standard library functions but I reckon that could be tricky!

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.

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

Hmmm, I shouldn't have to do this.  Are there plans afoot to modernize
OCaml's string-handling?

-- Paul