Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit modifies
cpipes
to useiconv
to convert the internally-encoded pipe character lists, which are in UTF-8, to the user's locale (#9). As a bonus, it includes functions to convert from the user's locale into UTF-8, so it is now trivial to add custom lists of characters.The implementation details are described in the comment at the head of
pipes.c
, so I won't re-hash them here.As an example of this in action, here is the previous version (before this commit) running in

urxvt
in a GB18030 locale:Very matrix-esque, but not what we're looking for.
After this commit, it looks like this, as intended:

There are some problems with this, which I think are mostly caused by multi-column characters. For example, xterm is still quite broken:

Interestingly, increasing the number of pipes fixes some of the alignment problems in xterm:

This leads me to think it may be related to ncurses' local move optimisations, as having two pipes will mean ncurses prefers to use
cup
rather than local moves like\b\b\b
. I don't know whether the fault lies in ncurses (unlikely), terminfo (possible) or xterm (possible), and I don't care nearly enough to find out.This commit also adds a unit test for the locale conversion. I've included an update Travis CI config that runs the unit test using
prove
as a test runner, which should be present on most dev machines.