pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: porting yasr: non-standard WCHAR_T in iconv_open()



On Tue, 27 Feb 2024, Jörg Sonnenberger wrote:
On Tuesday, February 27, 2024 11:15:02 PM CET adr wrote:
Any advice, is there already a better (and portable) way? I haven't
found any similar patch in pkgsrc.

The portable way is to ask nl_langinfo for the actual encoding of the locale
and convert to that first. Afterwards mbstowcs can be used to convert the
input string to a wide char string.

Joerg

The code uses nl_langinfo() to get the local encoding, and then
uses iconv to do the translation. I didn't want to change the use
of iconv expecting to be a large change, but after your mail I
reviewed the code and I think that using mbstowcs() and wcstombs()
would be pretty easy.

Thanks for the suggestion.

adr


Home | Main Index | Thread Index | Old Index