caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@mpi-sws.org>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] Ocaml and Windows' notion of Unicode file names
Date: Sun, 15 May 2016 14:39:53 +0200	[thread overview]
Message-ID: <FA282324-34B1-4A72-91B2-085B5F123782@mpi-sws.org> (raw)
In-Reply-To: <CALdWJ+xsbLyUKZ0zC4wrS+DpVqG7pAM1E+1s3AHp6d56=ZSBcQ@mail.gmail.com>

Does anybody have advice for dealing with unicode file names under Windows? In particular, my problem is that the following invariant

  let files = Array.to_list (Sys.readdir “.”) in
  assert (List.for_all Sys.file_exists files)

does not hold under Windows, because some of the file names returned by readdir are not valid.

The Unix emulation module has the same issue.

This is only partially Ocaml’s fault — I see that it implements Sys.readdir and Unix.readdir using Windows’ ASCII _findfirst and _findnext functions, which apparently just replace large code points with ‘?’. And I’m not sure how realistic it would be for Ocaml to switch to Windows' wchar APIs and, say, UTF8-encode/decode file names on its side.

But anyway, I’m wondering who else has run into this, and has an idea how to cope. Because I came up blank.

Thanks,
/Andreas


  reply	other threads:[~2016-05-15 12:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08 22:19 [Caml-list] IDE like PyCharm Allan Wegan
2016-05-09  8:08 ` Francois Berenger
2016-05-09  8:24   ` vrotaru.md
2016-05-09  9:44   ` Jean-Marc Alliot
2016-05-09 11:48 ` Ivan Gotovchits
2016-05-10 21:04 ` [Caml-list] IDE like PyCharm - Results Allan Wegan
2016-05-10 21:57   ` Benjamin Greenman
2016-05-10 23:16     ` Allan Wegan
2016-05-11  6:44       ` Vu Ngoc San
2016-05-10 22:08   ` Bahman Movaqar
2016-05-11  0:30     ` Allan Wegan
2016-05-11  6:16       ` David Allsopp
2016-05-11  6:51         ` vrotaru.md
2016-05-11 11:19         ` Allan Wegan
2016-05-11 11:23           ` Kakadu
2016-05-11 13:13           ` David Allsopp
2016-05-11 13:43       ` Hendrik Boom
2016-05-11 13:55         ` Ivan Gotovchits
2016-05-15 12:39           ` Andreas Rossberg [this message]
2016-05-15 16:42             ` [Caml-list] Ocaml and Windows' notion of Unicode file names Adrien Nader
2016-05-16  7:30               ` Matthieu Dubuget
2016-05-17 13:01                 ` rossberg
2016-05-11  6:54   ` [Caml-list] IDE like PyCharm - Results Leonardo Laguna Ruiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FA282324-34B1-4A72-91B2-085B5F123782@mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).