diff --git a/libcharset/lib/localcharset.c b/libcharset/lib/localcharset.c
index 3aceb42..dadd95a 100644
--- a/libcharset/lib/localcharset.c
+++ b/libcharset/lib/localcharset.c
@@ -455,7 +455,10 @@ locale_charset (void)
 # endif
 
 #elif defined WIN32_NATIVE
-
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+  // GetACP() not available to UWP apps
+  codeset = NULL;
+#else
   static char buf[2 + 10 + 1];
 
   /* Woe32 has a function returning the locale's codepage as a number:
@@ -467,7 +470,7 @@ locale_charset (void)
      encoding is the best bet.  */
   sprintf (buf, "CP%u", GetACP ());
   codeset = buf;
-
+#endif
 #elif defined OS2
 
   const char *locale;
