Subject: Re: Problems with libedit and international characters
To: Christos Zoulas <>
From: Chris Wilson <>
List: netbsd-users
Date: 09/23/2007 16:44:10
Hi Christos,

Many thanks for the fast and accurate response!

On Sun, 23 Sep 2007, Christos Zoulas wrote:

>> I'm not sure whether editline is doing the right thing here; I think it 
>> will have problems with UTF-8 and multibyte character sets, because it 
>> reads characters from the terminal one byte at a time, and checks them 
>> bytewise for printability. It should probably convert the input to 
>> Unicode and check Unicode characters for printability with iswprint().
> Yes, it will have a problem with UTF-8 and multi-byte character sets. It 
> is not too diffcutly to fix though. I have not bothered because there is 
> not enough demand. If you want to do it though, you can look at the tcsh 
> code (where the editline code was created from) and copy the changes.

Perhaps that code could be factored out of tcsh so that we don't have 
outdated copies of it lying around? And tcsh could use libedit?

Anyway I'm less scared of the libedit source code than I was, so now I 
won't be afraid to hack at it if/when this bug bites my backside :-) But 
right now I'm not sure I know what to do, unless it's trivial to copy out 
of tcsh. (I'd need a library or function for utf-8 reading/writing, I 
guess, and I don't know what that would be).

> You need to call setlocale(); this works:

You're absolutely right, now it works on glibc too, my bad!

If this is required to use editline, then perhaps it could be documented 
somewhere and added to the fileman example?

Cheers, Chris.
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <0000 at> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |