index  prev  next

Lining things up

--------------------------------------------------------------------------------------

In a command line utility it is often nice to line things up in columns. This is pretty easy if all you care about is English, but becomes quite nasty when you have to deal with arbitrary display character sets.

The problem is that a string has 3 lengths:

I naively assumed in my initial plan that the character length and number of columns would always be the same. Unfortunately that is not the case, for example many Japanese characters consume 2 columns when displayed.

This presents us with a bit of a problem. We were planning on basing all our character set hanlding on the iconv() interface, but that doesn't handle the column-width of strings at all. Right now we haven't solved this, but we will probably add a loadable interface for a character set specific column count function.

--------------------------------------------------------------------------------------

CIFS2001 Seattle
tridge@valinux.com