On Fri, Dec 19, 2008 at 9:40 AM, Salvatore Insalaco <[email protected]> wrote:
> On Fri, Dec 19, 2008 at 2:15 PM, Judah Jacobson
> <[email protected]> wrote:
>> I've uploaded a fix to the repo at http://code.haskell.org/haskeline ;
>> can you please verify whether this works for you?
>
> I tried and we are *almost* there :).

Unfortunately that may be too optimistic; see below...

> -----------------8<----------------------
> What is the patch name? dasdasdasdsadas@@####àààùùùa+èsdès+dasdas
> Do you want to add a long comment? [yn]n
> Finished recording patch 'dasdasdasdsadas@@####ÓÓÓ¨¨¨a+ÞsdÞs+dasdas'
> -------------------------------------------
>
> As you can see typing international characters now works, but there're
> some problems with code pages. (à becomes Ó and so on). This doesn't
> happen without Haskeline.

The problem is that Haskeline decodes the console input and returns
Unicode Chars, but Darcs expects to be given encoded, 8-bit Chars (as
are returned by the non-Haskeline backend).  Thus when it prints out
the "Finished recording" message, it uses System.IO.putStrLn which
ignores the higher-order bytes.

It seems to me (although I'm still new to darcs development) that the
best long-term fix would be for darcs to store everything internally
as Unicode Chars (including both file and line input).  Then it could
read/write to the terminal using the console's current
(system-dependent) encoding, whether that's a code page, UTF-8 or
whatever.  (I really, really wish GHC's text I/O already provided this
by default...)

Anyway, I checked and POSIX has this same issue.  For POSIX, I think
this is fixable by darcs just re-encoding in UTF-8 the strings that it
receives from Haskeline.  I'll send a patch.

On Windows, the equivalent re-encoding would probably need to depend
on the current code page; Win32  provides the function
WideCharToMultiByte, but it's not already exported by any ghc
libraries.  Maybe we should wait to add Haskeline back to
darcs+Windows until Darcs' Unicode story is worked out.

-Judah
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to