From: David Allsopp <dra-news@metastack.com>
To: "Mattias Engdegård" <mattiase@acm.org>,
"OCaml List (caml-list@inria.fr)" <caml-list@inria.fr>
Subject: RE: [Caml-list] OCaml 4.06.0+rc1
Date: Thu, 2 Nov 2017 11:59:30 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9016D597F6F@Remus.metastack.local> (raw)
In-Reply-To: <09738422-5ADF-43DE-856A-2727515BD2FA@acm.org>
Mattias Engdegård wrote:
> 30 okt. 2017 kl. 19.25 skrev David Allsopp <dra-news@metastack.com>:
> >
> > One of the big changes for the native Windows ports of OCaml is that
> we now have support for UTF-8 filenames in the runtime.
> >
> > TL;DR functions like Sys.readdir no longer return garbage (or at best
> locale-specific strings).
>
> This sounds like very good news, but just for curiosity, how are
> unpaired surrogates in file names handled? (I have no Windows machine
> handy.) Does readdir raise an exception, or return useless rubbish, or
> somehow encode the surrogates in a form that can be used by other file
> handling functions?
This is a good question - and indeed is a section I should add to the post. At the moment, you will get a Sys_error exception informing you that "No mapping for the Unicode character exists in the target multi-byte code page" - in other words, the runtime refuses to give invalid UTF-8 in this case.
If you configure OCaml with WINDOWS_UNICODE=0 then, as in previous versions, you will get a nonsense string, but no exception.
We plan in 4.07.0 to address this but it hasn't been dealt with in this release mainly because unpaired surrogates in filenames are a highly parasitic case and also because this issue does not (I believe) only affect Windows.
David
next prev parent reply other threads:[~2017-11-02 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 11:49 Gabriel Scherer
2017-10-30 18:25 ` David Allsopp
[not found] ` <09738422-5ADF-43DE-856A-2727515BD2FA@acm.org>
2017-11-02 11:59 ` David Allsopp [this message]
2017-11-03 10:53 ` [Caml-list] Upcoming breaking changes in Ocamldoc 4.06 octachron
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=E51C5B015DBD1348A1D85763337FB6D9016D597F6F@Remus.metastack.local \
--to=dra-news@metastack.com \
--cc=caml-list@inria.fr \
--cc=mattiase@acm.org \
/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