caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Michael Ekstrand <michael@elehack.net>
To: caml-list@yquem.inria.fr,
	Batteries Development <batteries-devel@lists.forge.ocamlcore.org>
Subject: Re: [Caml-list] Re: Unicode, update
Date: Tue, 19 Oct 2010 10:19:53 -0500	[thread overview]
Message-ID: <4CBDB719.8060804@elehack.net> (raw)
In-Reply-To: <AANLkTi=J4o5avEWH7wEXrL3Rw+kF6Q4_nmeKKax4BWr1@mail.gmail.com>

On 10/19/2010 09:33 AM, Ashish Agarwal wrote:
> Have you considered adding these to the Batteries project? It would be
> good to get general purpose functionality added directly there. Also
> that way you don't have to feel you've done a lot of things; a single
> useful function could be added.

I think there is promise in adding such functionality to Batteries'
BatFile module, particularly if we adopt a design similar to that of
Glib's filename support:

* An abstract (or private) type 'filename': on Win32, this is a UTF-8 or
UCS-2 Unicode string; on Unix, it is a string in the locale encoding
(which is the best you can do, unfortunately).
* Functions to convert to UTF-8 and the current locale for printing and
display.
* Idempotent conversion to/from UTF-8 for portable storage.  Glib
implements this with file:/// URLs, so that the non-ASCII characters can
be URL-encoded and thus preserved.
* Conversion from UTF-8 to handle user input, with the caveat that
converting to UTF-8 and back will not necessarily result in the same
filename.

There might be types and definitions in lablgtk2 that we could try to be
compatible with (particularly so you can use the results of a lablgtk2
file chooser as a filename to open).

OTOH, Qt seems to get along using Unicode strings for filenames, so the
encoding issues might not be that big a deal in practice.  The easy path
of just adding UTF-8 file open functions to BatFile (taking BatUTF8.t)
might be OK.

- Michael

> On Mon, Oct 18, 2010 at 9:59 PM, Paul Steckler <steck@stecksoft.com
> <mailto:steck@stecksoft.com>> wrote:
> 
>     Sylvain Le Gall <sylvain@le-gall.net <mailto:sylvain@le-gall.net>>
>     wrote:
>     > Would it be possible to publish them as an external library?
> 
>     What I did isn't really complete enough to constitute a library, I'd
>     say.
> 
>     Here's what I did:
> 
>     >From Pervasives:
> 
>      open_out_win32
>      open_out_bin_win32
>      open_out_gen_win32
>      open_in_win32
>      open_in_bin_win32
>      open_in_gen_win32
> 
>     >From Sys:
> 
>      file_exists_win32
>      getcwd_win32
>      chdir_win32
>      missing: is_directory_win32, readdir_win32
> 
>     I did not code up Win32/UTF8 equivalents of anything in the Unix
>     module.  A complete
>     library of Win32/UTF8 file functions would include a number of items
>     from that module.
> 
>     If anyone's interested in finishing off what I've done, I could send
>     along
>     what I have.
> 
>     -- Paul
> 
>     _______________________________________________
>     Caml-list mailing list. Subscription management:
>     http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>     Archives: http://caml.inria.fr
>     Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>     Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> 
> 
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


      reply	other threads:[~2010-10-19 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19  1:59 Paul Steckler
2010-10-19 14:33 ` [Caml-list] " Ashish Agarwal
2010-10-19 15:19   ` Michael Ekstrand [this message]

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=4CBDB719.8060804@elehack.net \
    --to=michael@elehack.net \
    --cc=batteries-devel@lists.forge.ocamlcore.org \
    --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;
as well as URLs for NNTP newsgroup(s).