[hackers] [PATCH][dmenu/libsl] render invalid utf8 bytes as U+FFFD

From: NRK <nrk_AT_disroot.org>
Date: Fri, 5 Jul 2024 02:40:45 +0000

This is a follow up to a discussion from the dev list:
https://lists.suckless.org/dev/2407/35646.html

I've separated the patch into two halves.

1. Replaces the current utf8decoder with a shorter and more direct one.
   It reports back errors and how much to advance on error (needed for the
   next patch)
2. Detects invalid utf8 bytes and renders them as U+FFFD instead of
   passing invalid bytes to xft which cuts it off.

If keeping the current utf8 decoder is important, I can look into how to
change it so that it can return error information back to the caller.
But IMHO the current decoder is unnecessarily overcomplicated for
libsl's need.

The interaction between invalid utf8 sequence and ellipsis is a bit
finicky and could use some extra eyes. But so far it has worked well in
my testing.

- NRK

Received on Fri Jul 05 2024 - 04:40:45 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 05 2024 - 04:48:37 CEST