diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
index 4e29002..adb5f47 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java
@@ -325,7 +325,7 @@
             return null;
         }
         if (Utils.codePointCount(text) == 1) {
-            return new String[] { text };
+            return text.codePointAt(0) == COMMA ? null : new String[] { text };
         }
 
         ArrayList<String> list = null;
@@ -333,10 +333,13 @@
         for (int pos = 0; pos < size; pos++) {
             final char c = text.charAt(pos);
             if (c == COMMA) {
-                if (list == null) {
-                    list = new ArrayList<String>();
+                // Skip empty entry.
+                if (pos - start > 0) {
+                    if (list == null) {
+                        list = new ArrayList<String>();
+                    }
+                    list.add(text.substring(start, pos));
                 }
-                list.add(text.substring(start, pos));
                 // Skip comma
                 start = pos + 1;
             } else if (c == ESCAPE_CHAR) {
@@ -344,10 +347,13 @@
                 pos++;
             }
         }
+        final String remain = (size - start > 0) ? text.substring(start) : null;
         if (list == null) {
-            return new String[] { text.substring(start) };
+            return remain != null ? new String[] { remain } : null;
         } else {
-            list.add(text.substring(start));
+            if (remain != null) {
+                list.add(remain);
+            }
             return list.toArray(new String[list.size()]);
         }
     }
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java
index 721c801..a0ce86d 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/KeySpecParserCsvTests.java
@@ -42,7 +42,8 @@
         final String actual[] = KeySpecParser.parseCsvString(value, mTestResources,
                 R.string.empty_string);
         if (expected.length == 0) {
-            assertNull(message, actual);
+            assertNull(message + ": expected=null actual=" + Arrays.toString(actual),
+                    actual);
             return;
         }
         assertEquals(message + ": expected=" + Arrays.toString(expected)
@@ -74,6 +75,11 @@
 
     public void testParseCsvTextZero() {
         assertTextArray("Empty string", "");
+        assertTextArray("Empty entry", ",");
+        assertTextArray("Empty entry at beginning", ",a", "a");
+        assertTextArray("Empty entry at end", "a,", "a");
+        assertTextArray("Empty entry at middle", "a,,b", "a", "b");
+        assertTextArray("Empty entries with escape", ",a,b\\,c,,d,", "a", "b\\,c", "d");
     }
 
     public void testParseCsvTextSingle() {
@@ -82,7 +88,7 @@
         assertTextArray("Single escape", "\\", "\\");
         assertTextArray("Space", " ", " ");
         assertTextArray("Single label", "abc", "abc");
-        assertTextArray("Single srrogate pairs label", SURROGATE2, SURROGATE2);
+        assertTextArray("Single surrogate pairs label", SURROGATE2, SURROGATE2);
         assertTextArray("Spaces", "   ", "   ");
         assertTextArray("Spaces in label", "a b c", "a b c");
         assertTextArray("Spaces at beginning of label", " abc", " abc");
