Skip to content

Commit

Permalink
locale.c: langinfo: Use Windows fcn to find CODESET
Browse files Browse the repository at this point in the history
There is a Windows function, available for quite a long time, that will
return the current code page.  Use this for the nl_langinfo() CODESET,
as that libc function isn't implemented on Windows.
  • Loading branch information
khwilliamson committed May 9, 2021
1 parent 1792a5b commit 3b53baa
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions locale.c
Expand Up @@ -3525,8 +3525,21 @@ S_my_langinfo(pTHX_

# else

{ /* But on Windows, the name does seem to be consistent, so
use that. */
{
/* This function retrieves the code page. It is subject to change,
* but is documented and has been stable for many releases */
UINT ___lc_codepage_func(void);

retval = save_to_buffer(Perl_form(aTHX_ "%d", ___lc_codepage_func()),
retbufp, retbuf_sizep);
DEBUG_Lv(PerlIO_printf(Perl_debug_log, "locale='%s' cp=%s\n",
locale, retval));
return retval;
}

# endif

{ /* Temporarily unreachable */
const char * name = querylocale_c(LC_CTYPE);

if (isNAME_C_OR_POSIX(name)) {
Expand Down

0 comments on commit 3b53baa

Please sign in to comment.