I always got an encoding error running those macros.

I chased it down to the use of the wrong separator. On computers with english region settings the "digit grouping symbol" and the "list separator" are usually the same character a comma. But for most other countries they differ from each other and we need to use the latter.
The "digit grouping symbol" is in our case the character '
And that naturally messes up the assembly of the output string since it is also limited by them. You would have to double encapsulate them, or something like that, to make it work.
In both macros I replaced
c = CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator
with
c = CultureInfo.CurrentCulture.TextInfo.ListSeparator