Index: src/perl/register-dataset.cgi
===================================================================
--- src/perl/register-dataset.cgi	(revision 2036)
+++ src/perl/register-dataset.cgi	(revision 2037)
@@ -1018,7 +1018,25 @@
     return $returnVal;
 }
 
+
 ################################################################################
+#
+# Subroutine for replacing characters that might create problem in HTML. 
+# Specifically written for " being used in any text field. This create a 
+# problem in confirmData template, when you specify input name value pair 
+# with value having a " in it.  
+#
+################################################################################
+sub normalizeCD{
+    my $val = shift;
+
+    $val =~ s/\"/&quot;/g;
+    
+    return $val;
+}
+
+
+################################################################################
 # 
 # Create the XML document from the HTML form input
 # returns the XML document as a string
@@ -2425,8 +2443,8 @@
     }
 
 
-    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
-    $$templateVars{'providerSurName'} = $FORM::providerSurName;
+    $$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName);
+    $$templateVars{'providerSurName'} = normalizeCD($FORM::providerSurName);
     if($FORM::site eq "Select your station here."){
         $$templateVars{'site'} = "";
     }else{
@@ -2435,132 +2453,132 @@
     if($FORM::cfg eq "nceas"){
         $$templateVars{'wg'} = \@FORM::wg;
     }
-    $$templateVars{'identifier'} = $FORM::identifier;
-    $$templateVars{'title'} = $FORM::title;
-    $$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
-    $$templateVars{'origNamelast0'} = $FORM::origNamelast0;
-    $$templateVars{'origNameOrg'} = $FORM::origNameOrg;
+    $$templateVars{'identifier'} = normalizeCD($FORM::identifier);
+    $$templateVars{'title'} = normalizeCD($FORM::title);
+    $$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0);
+    $$templateVars{'origNamelast0'} = normalizeCD($FORM::origNamelast0);
+    $$templateVars{'origNameOrg'} = normalizeCD($FORM::origNameOrg);
     # $$templateVars{'origRole0'} = $FORM::origRole0;
-    $$templateVars{'origDelivery'} = $FORM::origDelivery;
-    $$templateVars{'origCity'} = $FORM::origCity;
+    $$templateVars{'origDelivery'} = normalizeCD($FORM::origDelivery);
+    $$templateVars{'origCity'} = normalizeCD($FORM::origCity);
     if($FORM::origState eq "Select State Here."){
         $$templateVars{'origState'} = "";
     }else{
         $$templateVars{'origState'} = $FORM::origState;
     }
-    $$templateVars{'origStateOther'} = $FORM::origStateOther;
-    $$templateVars{'origZIP'} = $FORM::origZIP;
-    $$templateVars{'origCountry'} = $FORM::origCountry;
-    $$templateVars{'origPhone'} = $FORM::origPhone;
-    $$templateVars{'origFAX'} = $FORM::origFAX;
-    $$templateVars{'origEmail'} = $FORM::origEmail;
-    $$templateVars{'useOrigAddress'} = $FORM::useOrigAddress;
+    $$templateVars{'origStateOther'} = normalizeCD($FORM::origStateOther);
+    $$templateVars{'origZIP'} = normalizeCD($FORM::origZIP);
+    $$templateVars{'origCountry'} = normalizeCD($FORM::origCountry);
+    $$templateVars{'origPhone'} = normalizeCD($FORM::origPhone);
+    $$templateVars{'origFAX'} = normalizeCD($FORM::origFAX);
+    $$templateVars{'origEmail'} = normalizeCD($FORM::origEmail);
+    $$templateVars{'useOrigAddress'} = normalizeCD($FORM::useOrigAddress);
     if($FORM::useOrigAddress eq "on"){
-        $$templateVars{'origNamefirstContact'} = $FORM::origNamefirst0;
-        $$templateVars{'origNamelastContact'} = $FORM::origNamelast0;
-        $$templateVars{'origNameOrgContact'} = $FORM::origNameOrg;
-        $$templateVars{'origDeliveryContact'} = $FORM::origDelivery; 
-        $$templateVars{'origCityContact'} = $FORM::origCity;
+        $$templateVars{'origNamefirstContact'} = normalizeCD($FORM::origNamefirst0);
+        $$templateVars{'origNamelastContact'} = normalizeCD($FORM::origNamelast0);
+        $$templateVars{'origNameOrgContact'} = normalizeCD($FORM::origNameOrg);
+        $$templateVars{'origDeliveryContact'} = normalizeCD($FORM::origDelivery); 
+        $$templateVars{'origCityContact'} = normalizeCD($FORM::origCity);
         if($FORM::origState eq "Select State Here."){
         $$templateVars{'origStateContact'} = "";
         }else{
         $$templateVars{'origStateContact'} = $FORM::origState;
         }
-        $$templateVars{'origStateOtherContact'} = $FORM::origStateOther;
-        $$templateVars{'origZIPContact'} = $FORM::origZIP;
-        $$templateVars{'origCountryContact'} = $FORM::origCountry;
-        $$templateVars{'origPhoneContact'} = $FORM::origPhone;
-        $$templateVars{'origFAXContact'} = $FORM::origFAX;
-        $$templateVars{'origEmailContact'} = $FORM::origEmail;
+        $$templateVars{'origStateOtherContact'} = normalizeCD($FORM::origStateOther);
+        $$templateVars{'origZIPContact'} = normalizeCD($FORM::origZIP);
+        $$templateVars{'origCountryContact'} = normalizeCD($FORM::origCountry);
+        $$templateVars{'origPhoneContact'} = normalizeCD($FORM::origPhone);
+        $$templateVars{'origFAXContact'} = normalizeCD($FORM::origFAX);
+        $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmail);
     }else{
-        $$templateVars{'origNamefirstContact'} = $FORM::origNamefirstContact;
-        $$templateVars{'origNamelastContact'} = $FORM::origNamelastContact;
-        $$templateVars{'origNameOrgContact'} = $FORM::origNameOrgContact;
-        $$templateVars{'origDeliveryContact'} = $FORM::origDeliveryContact; 
-        $$templateVars{'origCityContact'} = $FORM::origCityContact;
+        $$templateVars{'origNamefirstContact'} = normalizeCD($FORM::origNamefirstContact);
+        $$templateVars{'origNamelastContact'} = normalizeCD($FORM::origNamelastContact);
+        $$templateVars{'origNameOrgContact'} = normalizeCD($FORM::origNameOrgContact);
+        $$templateVars{'origDeliveryContact'} = normalizeCD($FORM::origDeliveryContact); 
+        $$templateVars{'origCityContact'} = normalizeCD($FORM::origCityContact);
         if($FORM::origStateContact eq "Select State Here."){
         $$templateVars{'origStateContact'} = "";
         }else{
         $$templateVars{'origStateContact'} = $FORM::origStateContact;
         }
-        $$templateVars{'origStateOtherContact'} = $FORM::origStateOtherContact;
-        $$templateVars{'origZIPContact'} = $FORM::origZIPContact;
-        $$templateVars{'origCountryContact'} = $FORM::origCountryContact;
-        $$templateVars{'origPhoneContact'} = $FORM::origPhoneContact;
-        $$templateVars{'origFAXContact'} = $FORM::origFAXContact;
-        $$templateVars{'origEmailContact'} = $FORM::origEmailContact;    
+        $$templateVars{'origStateOtherContact'} = normalizeCD($FORM::origStateOtherContact);
+        $$templateVars{'origZIPContact'} = normalizeCD($FORM::origZIPContact);
+        $$templateVars{'origCountryContact'} = normalizeCD($FORM::origCountryContact);
+        $$templateVars{'origPhoneContact'} = normalizeCD($FORM::origPhoneContact);
+        $$templateVars{'origFAXContact'} = normalizeCD($FORM::origFAXContact);
+        $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmailContact);    
     }
-    $$templateVars{'origNamefirst1'} = $FORM::origNamefirst1;
-    $$templateVars{'origNamelast1'} = $FORM::origNamelast1;
+    $$templateVars{'origNamefirst1'} = normalizeCD($FORM::origNamefirst1);
+    $$templateVars{'origNamelast1'} = normalizeCD($FORM::origNamelast1);
     if($FORM::origNamefirst1 eq "" && $FORM::origNamelast1 eq ""){
         $$templateVars{'origRole1'} = "";
     }else{
         $$templateVars{'origRole1'} = $FORM::origRole1;
     }
-    $$templateVars{'origNamefirst2'} = $FORM::origNamefirst2;
-    $$templateVars{'origNamelast2'} = $FORM::origNamelast2;
+    $$templateVars{'origNamefirst2'} = normalizeCD($FORM::origNamefirst2);
+    $$templateVars{'origNamelast2'} = normalizeCD($FORM::origNamelast2);
     if($FORM::origNamefirst2 eq "" && $FORM::origNamelast2 eq ""){
         $$templateVars{'origRole2'} = "";
     }else{
         $$templateVars{'origRole2'} = $FORM::origRole2;
     }
-    $$templateVars{'origNamefirst3'} = $FORM::origNamefirst3;
-    $$templateVars{'origNamelast3'} = $FORM::origNamelast3;
+    $$templateVars{'origNamefirst3'} = normalizeCD($FORM::origNamefirst3);
+    $$templateVars{'origNamelast3'} = normalizeCD($FORM::origNamelast3);
     if($FORM::origNamefirst3 eq "" && $FORM::origNamelast3 eq ""){
         $$templateVars{'origRole3'} = "";
     }else{
         $$templateVars{'origRole3'} = $FORM::origRole3;
     }
-    $$templateVars{'origNamefirst4'} = $FORM::origNamefirst4;
-    $$templateVars{'origNamelast4'} = $FORM::origNamelast4;
+    $$templateVars{'origNamefirst4'} = normalizeCD($FORM::origNamefirst4);
+    $$templateVars{'origNamelast4'} = normalizeCD($FORM::origNamelast4);
     if($FORM::origNamefirst4 eq "" && $FORM::origNamelast4 eq ""){
         $$templateVars{'origRole4'} = "";
     }else{
         $$templateVars{'origRole4'} = $FORM::origRole4;
     }
-    $$templateVars{'origNamefirst5'} = $FORM::origNamefirst5;
-    $$templateVars{'origNamelast5'} = $FORM::origNamelast5;
+    $$templateVars{'origNamefirst5'} = normalizeCD($FORM::origNamefirst5);
+    $$templateVars{'origNamelast5'} = normalizeCD($FORM::origNamelast5);
     if($FORM::origNamefirst5 eq "" && $FORM::origNamelast5 eq ""){
         $$templateVars{'origRole5'} = "";
     }else{
         $$templateVars{'origRole5'} = $FORM::origRole5;
     }
-    $$templateVars{'origNamefirst6'} = $FORM::origNamefirst6;
-    $$templateVars{'origNamelast6'} = $FORM::origNamelast6;
+    $$templateVars{'origNamefirst6'} = normalizeCD($FORM::origNamefirst6);
+    $$templateVars{'origNamelast6'} = normalizeCD($FORM::origNamelast6);
     if($FORM::origNamefirst6 eq "" && $FORM::origNamelast6 eq ""){
         $$templateVars{'origRole6'} = "";
     }else{
         $$templateVars{'origRole6'} = $FORM::origRole6;
     }
-    $$templateVars{'origNamefirst7'} = $FORM::origNamefirst7;
-    $$templateVars{'origNamelast7'} = $FORM::origNamelast7;
+    $$templateVars{'origNamefirst7'} = normalizeCD($FORM::origNamefirst7);
+    $$templateVars{'origNamelast7'} = normalizeCD($FORM::origNamelast7);
     if($FORM::origNamefirst7 eq "" && $FORM::origNamelast7 eq ""){
         $$templateVars{'origRole7'} = "";
     }else{
         $$templateVars{'origRole7'} = $FORM::origRole7;
     }
-    $$templateVars{'origNamefirst8'} = $FORM::origNamefirst8;
-    $$templateVars{'origNamelast8'} = $FORM::origNamelast8;
+    $$templateVars{'origNamefirst8'} = normalizeCD($FORM::origNamefirst8);
+    $$templateVars{'origNamelast8'} = normalizeCD($FORM::origNamelast8);
     if($FORM::origNamefirst8 eq "" && $FORM::origNamelast8 eq ""){
         $$templateVars{'origRole8'} = "";
     }else{
         $$templateVars{'origRole8'} = $FORM::origRole8;
     }
-    $$templateVars{'origNamefirst9'} = $FORM::origNamefirst9;
-    $$templateVars{'origNamelast9'} = $FORM::origNamelast9;
+    $$templateVars{'origNamefirst9'} = normalizeCD($FORM::origNamefirst9);
+    $$templateVars{'origNamelast9'} = normalizeCD($FORM::origNamelast9);
     if($FORM::origNamefirst9 eq "" && $FORM::origNamelast9 eq ""){
         $$templateVars{'origRole9'} = "";
     }else{
         $$templateVars{'origRole9'} = $FORM::origRole9;
     }
-    $$templateVars{'origNamefirst10'} = $FORM::origNamefirst10;
-    $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
+    $$templateVars{'origNamefirst10'} = normalizeCD($FORM::origNamefirst10);
+    $$templateVars{'origNamelast10'} = normalizeCD($FORM::origNamelast10);
     if($FORM::origNamefirst10 eq "" && $FORM::origNamelast10 eq ""){
         $$templateVars{'origRole10'} = "";
     }else{
         $$templateVars{'origRole10'} = $FORM::origRole10;
     }
-    $$templateVars{'abstract'} = $FORM::abstract;
+    $$templateVars{'abstract'} = normalizeCD($FORM::abstract);
     $$templateVars{'keyCount'} = $FORM::keyCount;
     foreach my $kyd (param()) {
 	if ($kyd =~ /keyword/) {
@@ -2571,7 +2589,7 @@
 	    if ( $keyIndex =~ /[0-9]/ ){
 		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
 		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
-		    $$templateVars{$kyd} = param($kyd);
+		    $$templateVars{$kyd} = normalizeCD(param($kyd));
 		    $$templateVars{$keyType} = param($keyType);
 		    $$templateVars{$keyTh} = param($keyTh);
 		}
@@ -2578,7 +2596,7 @@
 	    }
 	}
     }
-    $$templateVars{'addComments'} = $FORM::addComments;
+    $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
     $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
     $$templateVars{'url'} = $FORM::url;
@@ -2587,7 +2605,7 @@
     }else{
         $$templateVars{'dataMedium'} = $FORM::dataMedium;
     }    
-    $$templateVars{'dataMediumOther'} = $FORM::dataMediumOther;
+    $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
     $$templateVars{'beginningYear'} = $FORM::beginningYear;
     $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
     $$templateVars{'beginningDay'} = $FORM::beginningDay;
@@ -2594,7 +2612,7 @@
     $$templateVars{'endingYear'} = $FORM::endingYear;
     $$templateVars{'endingMonth'} = $FORM::endingMonth;
     $$templateVars{'endingDay'} = $FORM::endingDay;
-    $$templateVars{'geogdesc'} = $FORM::geogdesc;
+    $$templateVars{'geogdesc'} = normalizeCD($FORM::geogdesc);
     $$templateVars{'useSiteCoord'} = $FORM::useSiteCoord;
     $$templateVars{'latDeg1'} = $FORM::latDeg1;
     $$templateVars{'latMin1'} = $FORM::latMin1;
@@ -2622,18 +2640,23 @@
             if ( $taxIndex =~ /[0-9]/ ){
                 if (hasContent(param($trn)) && hasContent(param($trv))) {
                     debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
-                    $$templateVars{$trn} = param($trn);
-                    $$templateVars{$trv} = param($trv);
+                    $$templateVars{$trn} = normalizeCD(param($trn));
+                    $$templateVars{$trv} = normalizeCD(param($trv));
                 }
             }
         }
     }
-    $$templateVars{'taxaAuth'} = $FORM::taxaAuth;
+    $$templateVars{'taxaAuth'} = normalizeCD($FORM::taxaAuth);
 
-    $$templateVars{'methodTitle'} = $FORM::methodTitle;
-    $$templateVars{'methodPara'} = \@FORM::methodPara;
-    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
-    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
+    $$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
+
+    my @tempMethodPara;
+    for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
+	$tempMethodPara[$i] = normalizeCD($FORM::methodPara[$i]);
+    }
+    $$templateVars{'methodPara'} = \@tempMethodPara;
+    $$templateVars{'studyExtentDescription'} = normalizeCD($FORM::studyExtentDescription);
+    $$templateVars{'samplingDescription'} = normalizeCD($FORM::samplingDescription);
     $$templateVars{'docid'} = $FORM::docid;
 
     if (! $error) {
