From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] ncurses-ruby-1.2.3 + ncursesw hack breaks search
Date: Wed, 01 Jul 2009 08:28:46 -0700 [thread overview]
Message-ID: <1246461233-sup-208@entry> (raw)
In-Reply-To: <1246437271-sup-7636@cannonball>
Reformatted excerpts from Ingmar Vanhassel's message of 2009-07-01:
> [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477366#52
Interesting thread. I disagree with the conclusion that a separate
libncursesw-ruby package should be created. Maybe I'll respond.
The analysis of Sup is wrong. He says: "Looking at the source code of
the mailer I'd say that it is not really suited for UTF-8 encoded
strings yet, as it still assumes that the length of a string in bytes is
equal to the number of characters in the string." This is not really
true. What Sup assumes is that String#length gives the length of the
string in characters. This is obviously false in Ruby 1.8 (without
monkeypatching), but it is true in Ruby 1.9.
What *does* need to happen for Sup to really, actually, correctly
display non-ASCII characters, besides having a ncurses library that's
linked against ncursesw, is to be able to call the 'wcwidth' and
'wcswidth' functions. The current #display_length function is a hack
that's broken for e.g. Chinese characters.
One way to do this would be to use dl/import like we do for setlocale().
I've played around with this but haven't really gotten it to work. If
someone can get any further than the below, please let me know:
require 'dl/import'
module LibC
extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
dlload "libc.so.6"
extern "void setlocale(int, const char *)"
extern "int wcwidth(int)"
extern "int wcswidth(const int*, int)"
end
That "works", as in doesn't throw any exceptions, but then calling
LibC.wcswidth doesn't return the right thing, presumably because the
Ruby string isn't being converted into an array of ints, or something. I
don't really know how this works.
> Has anyone noticed that newer versions of ncurses-ruby plus that
> ncursesw hack [1] (to link to ncurses with widechar support) breaks
> search?
I don't have these newer versions available on my system yet (Ubuntu).
> When I search for 'foo', sup launches a search for a bunch of weird
> characters, not for 'foo', which obviously returns nothing useful.
Disturbing.
--
William <wmorgan-sup at masanjin.net>
next prev parent reply other threads:[~2009-07-01 15:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 21:39 [sup-talk] Character encoding when displaying quoted-printable messages Jim Cheetham
2009-07-01 5:20 ` Jim Cheetham
2009-07-01 8:38 ` [sup-talk] ncurses-ruby-1.2.3 + ncursesw hack breaks search Ingmar Vanhassel
2009-07-01 15:28 ` William Morgan [this message]
2009-07-01 15:42 ` Jörg-Hendrik Bach
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=1246461233-sup-208@entry \
--to=wmorgan-sup@masanjin.net \
/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