From: Paul Steckler <steck@stecksoft.com>
To: caml-list@yquem.inria.fr
Subject: Unicode, update
Date: Thu, 14 Oct 2010 21:18:35 +1100 [thread overview]
Message-ID: <AANLkTinH9kmUwwHa8sOQyHO+ARNY3oXA6bmdRseQgPiZ@mail.gmail.com> (raw)
A couple of weeks ago or so, I asked about using OCaml file primitives
with the Camomile library for Unicode
on Windows. I thought I'd update people on the list about my
resolution of these issues.
I decided to make the application UTF-8 throughout, so that the string
type always means UTF-8 -- OK, there
are a few exceptions to that rule. The SQLite3 library already deals
with UTF-8 in a graceful way, The same is
true for the C/C++ parsing library I'm using. That leaves the OCaml
library procedures, like open_in and open_out,
which definitely don't handle Unicode filenames on Windows.
I took the OCaml sources and made modified versions of functions, like
file_exists, open_in, and so on,
that convert filenames from UTF-8 to UTF-16 and then used "wide"
versions of the underlying Win32
primitives. In some cases, I had to convert UTF-16 back to UTF-8.
The Win32 functions MultiByteToWideChar
and WideCharToMultiByte handle those conversions nicely. I link in
these new functions, named
file_exists_win32, open_in_win32, etc., and everything works a treat.
-- Paul
next reply other threads:[~2010-10-14 10:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 10:18 Paul Steckler [this message]
2010-10-14 10:32 ` Sylvain Le Gall
2010-10-19 1:59 Paul Steckler
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=AANLkTinH9kmUwwHa8sOQyHO+ARNY3oXA6bmdRseQgPiZ@mail.gmail.com \
--to=steck@stecksoft.com \
--cc=caml-list@yquem.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