diff --git a/encoding.cabal b/encoding.cabal
--- a/encoding.cabal
+++ b/encoding.cabal
@@ -1,5 +1,5 @@
 Name:		encoding
-Version:	0.5.0
+Version:	0.5.1
 Author:		Henning Günther
 Maintainer:	h.guenther@tu-bs.de
 License:	BSD3
@@ -100,3 +100,9 @@
     Data.Encoding.Base
     Data.Encoding.Helper.Template
     Data.Encoding.GB18030Data
+  Includes:
+    system_encoding.h
+  Install-Includes:
+    system_encoding.h
+  C-Sources:
+    system_encoding.c
diff --git a/system_encoding.c b/system_encoding.c
new file mode 100644
--- /dev/null
+++ b/system_encoding.c
@@ -0,0 +1,9 @@
+#include "system_encoding.h"
+
+char* get_system_encoding() {
+#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+	return nl_langinfo(CODESET);
+#else
+	return "ASCII";
+#endif
+}
diff --git a/system_encoding.h b/system_encoding.h
new file mode 100644
--- /dev/null
+++ b/system_encoding.h
@@ -0,0 +1,10 @@
+#ifndef __SYSTEM_ENCODING__
+#define __SYSTEM_ENCODING__
+
+#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#include <langinfo.h>
+#endif
+
+char* get_system_encoding();
+
+#endif
