diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 99633f5e12a8412cb32b923a4623f37ea9b4f390..9e8caf7ef8e5f239fc8a9309c346141aec9655fb 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -76,6 +76,16 @@ c_cp932
 | >a   <               | 0123456789 |      4 | 
 | >abcd<               |            |      4 | 
 +----------------------+------------+--------+
++-------------------+
+| __ta帽g猫 脩茫m茅      |
++-------------------+
+| John Doe          | 
++-------------------+
++-------------------+
+| John Doe          |
++-------------------+
+| __ta帽g猫 脩茫m茅      | 
++-------------------+
 +------+------+---------------------------+
 | i    | j    | k                         |
 +------+------+---------------------------+
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index cf4e6f4047ce85cc62f45d8f69c75c207ea95bd6..c768c0e6bbc5b6949452e86582abb25ebe50ed9f 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -62,6 +62,12 @@ drop table t1;
 #
 --exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
 
+#
+# Bug#17939 Wrong table format when using UTF8 strings
+#
+--exec $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__ta帽g猫 脩茫m茅'" 2>&1
+--exec $MYSQL --default-character-set=utf8 --table -e "SELECT '__ta帽g猫 脩茫m茅' as 'John Doe'" 2>&1
+
 #
 # Bug#18265 -- mysql client: No longer right-justifies numeric columns
 #