Exactly the way we did it in Plan 9, and published in the paper cited earlier. In fact, it's possible the library work was done as early as 1989, but I'm not sure. Certainly by 1990.

-rob


On Mon, Mar 20, 2023 at 6:55 PM <arnold@skeeve.com> wrote:
Hi Rob.

Rob Pike <robpike@gmail.com> wrote:

> (Speaking of design by committee, the multibyte stuff in C89 was atrocious,
> and I heard was done in committee to get someone, perhaps the Japanese, to
> sign off.)

It's not lovely, but I wouldn't call it atrocious. It gets the job
done; code using it can handle multibyte encodings while being totally
character-set agnostic.  I speak from experience, gawk does this.
(I use the "restartable" routins - mbrlen() and so on.)

I understand that Unicode + UTF-8 solve the issue completely. But I'd
like to ask, in all seriousness and so that I can learn, given the world
as it was in 1989, how would you solve the problem? If you had designed
the C level routines, what would they have looked like?

Thanks,

Arnold