- buf_copy_rpad (i->output->s, i->width,
- ss_data (i->input), ss_length (i->input));
+ /* This is equivalent to buf_copy_rpad, except that we posibly
+ do a character set recoding in the middle. */
+ uint8_t *dst = value_str_rw (i->output, i->width);
+ size_t dst_size = i->width;
+ const char *src = ss_data (i->input);
+ size_t src_size = ss_length (i->input);
+
+ memcpy (dst, src, MIN (src_size, dst_size));
+
+ if (dst_size > src_size)
+ memset (&dst[src_size], ' ', dst_size - src_size);
+