diff --git a/tests/document-output-stream.c b/tests/document-output-stream.c
index 3768d72..930122d 100644
--- a/tests/document-output-stream.c
+++ b/tests/document-output-stream.c
@@ -426,6 +426,47 @@ test_utf16_utf8 ()
 	g_free (aux);
 }
 
+#define READLEN 10000
+#define WHICHGB 1
+#if WHICHGB
+	#define CHARSET "GBK"
+#else
+	#define CHARSET "GB18030"
+#endif
+
+static void
+test_gbk_gb18030 ()
+{
+	const GeditEncoding *guessed;
+	gchar *aux;
+	gchar buffer[READLEN];
+	gsize bytes_read;
+	GFile *file;
+	GFileInputStream *input;
+	GSList *encodings = NULL;
+
+	file = g_file_new_for_path ("gbk.txt");
+	input = g_file_read (file, NULL, NULL);
+	g_assert (input);
+
+	g_printf ("\nCHARSET=%s\n", CHARSET);
+
+	encodings = g_slist_append (encodings, (gpointer)gedit_encoding_get_from_charset ("UTF-8"));
+	encodings = g_slist_append (encodings, (gpointer)gedit_encoding_get_from_charset (CHARSET));
+	encodings = g_slist_append (encodings, (gpointer)gedit_encoding_get_from_charset ("ISO-8859-15"));
+	encodings = g_slist_append (encodings, (gpointer)gedit_encoding_get_from_charset ("UTF-16"));
+
+	while (g_input_stream_read_all ((GInputStream *)input, buffer, READLEN, &bytes_read, NULL, NULL) == TRUE && bytes_read)
+	{
+		aux = do_test (buffer, NULL, encodings, bytes_read, bytes_read, &guessed);
+		g_free (aux);
+		g_assert (guessed == gedit_encoding_get_from_charset (CHARSET));
+		g_printf ("read %u bytes\n", bytes_read);
+	}
+	
+	g_input_stream_close ((GInputStream *)input, NULL, NULL);
+}
+
 int main (int   argc,
           char *argv[])
 {
@@ -445,6 +486,8 @@ int main (int   argc,
 	g_test_add_func ("/document-output-stream/smart conversion: guessed", test_guessed);
 	g_test_add_func ("/document-output-stream/smart conversion: utf16-utf8", test_utf16_utf8);
 
+	g_test_add_func ("/document-output-stream/test-gbk-gb18030", test_gbk_gb18030);
+
 	return g_test_run ();
 }
 /* ex:ts=8:noet: */
