Commit Diff


commit - bcbd79e2dbba7016620ee0c8dcf3a3b207ef1c14
commit + 84717ec7d4074136fd55aa5edb18ae689e230d1a
blob - 2c3703e2bf1b24f41f58d6c3538d46f170f75e76
blob + 50a99bcd19c05d44c13dec6b03e9ea01c3490053
--- include/got_utf8.h
+++ include/got_utf8.h
@@ -15,3 +15,4 @@
  */
 
 const struct got_error *got_mbsavis(char**, int *, const char *);
+int got_locale_is_utf8(void);
blob - d1db624475bcd094aaa75a1bdf61679678a7d2b1
blob + f1d5f2fac1be26bb13465eb2a3b837c311a29b4f
--- lib/utf8.c
+++ lib/utf8.c
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
+#include <langinfo.h>
 
 #include "got_error.h"
 #include "got_utf8.h"
@@ -65,3 +66,10 @@ got_mbsavis(char** outp, int *widthp, const char *mbs)
 	*widthp = total_width;
 	return NULL;
 }
+
+int
+got_locale_is_utf8(void)
+{
+	char *codeset = nl_langinfo(CODESET);
+	return (strcmp(codeset, "UTF-8") == 0);
+}