diff --git a/modules/ncgi/ncgi.tcl b/modules/ncgi/ncgi.tcl
index 70a96c1..fcedc6e 100644
--- a/modules/ncgi/ncgi.tcl
+++ b/modules/ncgi/ncgi.tcl
@@ -815,7 +815,7 @@ proc ::ncgi::header {{type text/html} args} {
 #	parameters.  Given the above example, the return value is
 #	{
 #		value
-#		{param value param2 value param3 value3}
+#		{param value param2 value2 param3 value3}
 #	}
 
 proc ::ncgi::parseMimeValue {value} {
@@ -827,11 +827,10 @@ proc ::ncgi::parseMimeValue {value} {
             set key [string trim [string tolower $key]]
             set val [string trim $val]
             # Allow single as well as double quotes
-            if {[regexp -- {^["']} $val quote]} { ;# need a " for balance
-                if {[regexp -- ^${quote}(\[^$quote\]*)$quote $val x val2]} {
-                    # Trim quotes and any extra crap after close quote
-                    set val $val2
-                }
+            if {[regexp -- {^(['"])(.*)\1} $val x quote val2]} { ; # need a " for balance
+               # Trim quotes and any extra crap after close quote
+               # remove quoted quotation marks
+               set val [string map {\\" "\"" \\' "\'"} $val2]
             }
             lappend paramList $key $val
 	}
diff --git a/modules/ncgi/ncgi.test b/modules/ncgi/ncgi.test
index 5089a24..589b34d 100644
--- a/modules/ncgi/ncgi.test
+++ b/modules/ncgi/ncgi.test
@@ -578,6 +578,14 @@ test ncgi-13.6 {ncgi::parseMimeValue} {
     ncgi::parseMimeValue "text/html; charset=\"iso-8859-1\"morecrap"
 } {text/html {charset iso-8859-1}}
 
+test ncgi-13.7 {ncgi::parseMimeValue} {
+    ncgi::parseMimeValue {test/test; foo="bar\"baz\""}
+} {test/test {foo bar\"baz\"}}
+
+test ncgi-13.8 {ncgi::parseMimeValue} {
+    ncgi::parseMimeValue {test/test; foo=""}
+} {test/test {foo {}}}
+
 
 test ncgi-14.1 {ncgi::multipart} {
     catch {ncgi::multipart "application/x-www-urlencoded" name=val+ue} err
