diff --git a/dmenu.c b/dmenu.c
index fa7bbe8..afb5303 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#define _BSD_SOURCE
 #include <ctype.h>
 #include <locale.h>
 #include <stdarg.h>
@@ -709,7 +710,8 @@ main(int argc, char *argv[]) {
 		else
 			eprint("usage: dmenu [-i] [-b] [-fn <font>] [-nb <color>] [-nf <color>]\n"
 			       "             [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n");
-	setlocale(LC_CTYPE, "");
+	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
+		fprintf(stderr, "warning: no locale support\n");
 	if(!(dpy = XOpenDisplay(0)))
 		eprint("dmenu: cannot open display\n");
 	screen = DefaultScreen(dpy);