lib/fold: Add support for multibyte strings