Hi Gavin, > The module shouldn't load if it can't switch to a UTF-8 locale. xspara_init > returns a different value if these attempts fail leading the code loading > the module (in Texinfo::XSLoader) to fall back to the pure Perl version.
Ah, maybe this is what did not work in Eli's case on mingw? I wrote: > > The only portable way out is to use iconv() instead of setlocale(), > > mbrtowc(), > > etc. This is how e.g. gettext's PO parser does it: > > https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-tools/src/po-lex.c;h=22d08849206b812b18ace9de7629bb95a9d71c3c;hb=c9af3e4eeccc178a0833754e3d8c7083591e75ba > > lines 127..595. You will also find a function mb_width in there. Given that the only encoding you want to deal with is UTF-8, Eli's suggestion to use GNU libunistring is better than my iconv() suggestion. It has functions for width determination: https://www.gnu.org/software/libunistring/manual/html_node/uniwidth_002eh.html > but I doubt it is urgent to do before the release, as the current approach, > however flawed, has been in place and worked fairly well for a long time > (since the XS paragraph module was written). Well, it does not work on Windows. I agree with you that it's not urgent to do before the 7.1 release, since the Windows port is work-in-progress. Bruno