unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: ludo@gnu.org, guile-devel@gnu.org
Subject: Re: [PATCH] Implement open-process and related functions on MinGW
Date: Mon, 24 Feb 2014 23:12:19 +0200	[thread overview]
Message-ID: <838ut01ah8.fsf@gnu.org> (raw)
In-Reply-To: <878ut0nywb.fsf@yeeloong.lan>

> From: Mark H Weaver <mhw@netris.org>
> Cc: ludo@gnu.org,  guile-devel@gnu.org
> Date: Mon, 24 Feb 2014 13:33:56 -0500
> 
> >> For example, if it is true that we can avoid all the nasty problems with
> >> filename encoding by using the native Windows APIs that use UTF-16 for
> >> filenames, then I'd be in favor of doing that.
> >
> > What nasty problems do you have in mind?  I implemented something like
> > this in Emacs not long ago, so perhaps I can help here.
> 
> The nasty problem is that POSIX uses sequences of bytes for filenames,
> although conceptually filenames are character strings, and in fact
> virtually all user interfaces treat filenames as character strings.
> 
> Guile uses character strings for filenames (the only sane thing to do),
> and it would be good to build Guile on system APIs that also use
> character strings for filenames, instead of having to guess how to
> encode the characters into bytes.
> 
> We don't have a fully satisfactory solution to this problem on POSIX,
> but I guess we do on Windows, if we use the native Windows APIs.
> 
> BTW, the same problems exist for command-line arguments, environment
> variables, the hostname, etc.  All of these are sequences of bytes in
> POSIX, but conceptually they should be character strings.
> 
> If you'd like to work on a patch to have Guile use the native Windows
> APIs (that use UTF-16) for these things, I think that would be very
> useful and worthy of inclusion.

This issue needs to be carefully designed first.  File names are easy,
as long as Guile and the OS are concerned.  Environment variables and
command-line arguments likewise.  But once you need to display those
file names or variables, or ask the user to type them, there are
problems that don't have good solutions yet, at least not in Guile
applications that use the text terminal for display.

First, you need to bypass the usual stdio output routines and use
special APIs.  And after you've done that, you'll bump into the fact
that Windows console devices are limited in their ability to support
Unicode characters outside of the system locale; basically anything
beyond European scripts is not supported.  (Emacs avoids this problem
because its usual UI is a graphical one, where fonts and layout
engines are available that support almost any script in existence.)
Likewise for keyboard input: typing non-ASCII text into the Windows
console outside of the current console codepage is a tricky business;
basically, you need to completely bypass the "normal" stdio functions
and use Windows specific console APIs and Windows input methods.

There's also the issue of invoking other programs with arguments that
include Unicode characters.  Most programs that Guile will invoke on
Windows do not support that, they are "normal" console programs that
only support characters encoded in the current console codepage.
Windows will transparently convert from Unicode to the codepage
encoding, but if there are characters outside of that codepage, they
will be omitted or replaced by placebos, which might cause strange
failures.

There are also complications when calling functions from external
libraries that accept file names: those libraries will not normally
support Unicode characters in file names.  But this problem can be
solved by a known trick of using the 8+3 short aliases of the file
names, which use only ASCII characters.

So to provide something useful in this department, we need to discuss
what portions of Guile it is sensible and practical to convert to
Unicode, and how to treat those areas where we won't.  I will
certainly need some insider's help in this.



  parent reply	other threads:[~2014-02-24 21:12 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <wrbvbwejihe.fsf@sspiff.org>
     [not found] ` <wrbr471jxjg.fsf@sspiff.org>
     [not found]   ` <834n3x8o7m.fsf@gnu.org>
2014-02-17 20:59     ` [PATCH v2] Improved ^c support for gdb/guile Doug Evans
2014-02-17 21:13       ` Eli Zaretskii
2014-02-18  0:37         ` Doug Evans
2014-02-18 11:20           ` Ludovic Courtès
2014-02-18 16:01             ` Eli Zaretskii
2014-02-18 16:45               ` Ludovic Courtès
2014-02-18 16:56                 ` Eli Zaretskii
2014-02-18 17:45                   ` Ludovic Courtès
2014-02-18 17:59                     ` Eli Zaretskii
2014-02-18 23:08                       ` Ludovic Courtès
2014-02-18 17:32               ` MinGW patches Ludovic Courtès
2014-02-18 18:16                 ` Eli Zaretskii
2014-02-22 10:33                 ` [PATCH] Remove unneeded HAVE_POSIX conditionals Eli Zaretskii
2014-02-22 14:52                   ` Mark H Weaver
2014-02-22 15:41                     ` Eli Zaretskii
2014-02-26 21:42                     ` Ludovic Courtès
2014-02-22 10:50                 ` [PATCH] Implement open-process and related functions on MinGW Eli Zaretskii
2014-02-22 14:59                   ` Mark H Weaver
2014-02-22 15:43                     ` Eli Zaretskii
2014-02-22 15:54                   ` Mark H Weaver
2014-02-22 16:35                     ` Eli Zaretskii
2014-02-23  5:50                       ` Mark H Weaver
2014-02-23 17:54                         ` Eli Zaretskii
2014-02-24 18:33                           ` Mark H Weaver
2014-02-24 21:06                             ` Eli Zaretskii
2014-02-28  7:22                               ` Mark H Weaver
2014-02-28  9:10                                 ` Eli Zaretskii
2014-02-28 10:20                                   ` Mark H Weaver
2014-02-28 11:26                                     ` Eli Zaretskii
2014-02-24 21:12                             ` Eli Zaretskii [this message]
2014-02-22 18:20                     ` Eli Zaretskii
2014-02-22 22:02                       ` Mark H Weaver
2014-02-23  3:45                         ` Eli Zaretskii
2014-02-23  4:40                           ` Mark H Weaver
2014-02-23 17:46                             ` Eli Zaretskii
2014-02-23 20:14                               ` Mark H Weaver
2014-02-22 10:57                 ` MinGW patches Eli Zaretskii
2014-02-22 12:23                   ` Neil Jerram
2014-02-22 13:02                     ` Eli Zaretskii
2014-02-22 11:06                 ` Eli Zaretskii
2014-02-22 15:59                   ` Mark H Weaver
2014-02-22 16:36                     ` Eli Zaretskii
2014-02-23 14:21                       ` Mark H Weaver
2014-02-23 18:06                         ` Eli Zaretskii
2014-02-19  7:50               ` [PATCH v2] Improved ^c support for gdb/guile Mark H Weaver
2014-02-19 16:42                 ` Eli Zaretskii
2014-02-18 17:31             ` Doug Evans
2014-02-18 17:42               ` Signal delivery Ludovic Courtès
2014-02-18 17:56                 ` Doug Evans
2014-02-18 23:06                   ` Ludovic Courtès
2014-02-19  1:58                     ` Doug Evans

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=838ut01ah8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=mhw@netris.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).