On Thu, 14 Feb 2013, Christos Zoulas wrote:
Modified Files:
        src/usr.bin/vis: vis.c

More fixes from J.R. Oldroyd:

- In the call to strvisx() the count must be 1, not mbilen
 which can be 2 or 3 etc for a multibyte character.  This
 value is a count of characters - not bytes - to process.
 It even says characters in the man page.  In vis(3) I
 am interpreting this value to mean multibyte characters.

In general, the caller of str[n]vis[x] knows how many bytes of data they have, but they do not know how many multibyte characters that might represent. If the man page talks about characters, that's because it was written at a time when vis did not attempt to deal with multibyte characters. I think that we should revert to the original semantics of lengths being measured in bytes, and adjust both the man pages and callers appropriately.

--apb (Alan Barrett)

Reply via email to