diff --git a/sexp-format.c b/sexp-format.c
index 6fdc89109e1bd1defd7fdc4895a8812542cbde30..1db2563aac3608178faa6a38c0716cf3e51e5cb1 100644
--- a/sexp-format.c
+++ b/sexp-format.c
@@ -97,7 +97,7 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
       default:
 	{
 	  const char *start = format - 1;
-	  unsigned length = 1 + strcspn(format, "()%");
+	  unsigned length = 1 + strcspn(format, "()% \t");
 	  unsigned output_length = format_string(buffer, length, start);
 	  if (!output_length)
 	    return 0;
@@ -107,6 +107,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
 
 	  break;
 	}
+      case ' ': case '\t':
+	break;
+	
       case '\0':
 	assert(!nesting);
 	    
diff --git a/sexp.h b/sexp.h
index 1849988b963c4a9c41a2efedec1bcccdbea7a636..212527961686808063c41db87cf6bfcfaa9826b8 100644
--- a/sexp.h
+++ b/sexp.h
@@ -135,7 +135,8 @@ struct nettle_buffer;
  * buffer == NULL, just compute length.
  *
  * Format strings can contained matched parentheses, tokens ("foo" in
- * the format string is formatted as "3:foo"), and the following
+ * the format string is formatted as "3:foo"), whitespace (which
+ * separates tokens but is otherwise ignored) and the following
  * formatting specifiers:
  *
  *   %s   String represented as unsigned length, const uint8_t *data.