Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 33050)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java	(revision 33051)
@@ -20,7 +20,4 @@
 import java.io.InputStream;
 import java.io.IOException;
-//import java.io.UnsupportedEncodingException;
-//import java.net.URLEncoder;
-//import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Vector;
@@ -334,19 +331,9 @@
 		// http://www.cgi101.com/class/ch3/text.html
 		
-		// And need to ensure that special characters won't get clobbered on Windows by perl/CGI.pm (https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html), 
-		// URL encode the query_string, as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
-		
-		// perl/CGI.pm doesn't like us URL encoding the entire query string such as the equal sign between each paramName and paramValue.
-		// So we URL encode each paramValue separately, which is done in GS2Construct.java::runCommand()
-		/*
-		String old_query_string = this.query_string;
-		try{
-			this.query_string = URLEncoder.encode(this.query_string, StandardCharsets.UTF_8.name());
-			//this.query_string = this.query_string.replace("+","%2B"); // https://stackoverflow.com/questions/1211229/in-a-url-should-spaces-be-encoded-using-20-or
-		} catch(UnsupportedEncodingException uee) {
-			logger.warn("**** Unable to encode query_string in UTF-8, so attempting to continue with the unencoded value of query_string");
-			this.query_string = old_query_string; 
-		}
-		*/
+		// And since we need to ensure that special characters won't get clobbered on Windows by perl/CGI.pm
+		// (see https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html), 
+		// each param *value* in QUERY_STRING, not QUERY_STRING in entirety, is further URL encoded,
+		// as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
+		// This URL encoding of paramValues already happened in GS2Construct.java::runCommand(), so QUERY_STRING is ready now.
 		
 		String[] envvars = {
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 33050)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java	(revision 33051)
@@ -25,5 +25,4 @@
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
@@ -845,8 +844,10 @@
 				String paramvalue = (String) entry.getValue();
 
-				// And need to ensure that special characters won't get clobbered on Windows by perl/CGI.pm (https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html), 
-				// URL encode the query_string, as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
-		
-				// perl/CGI.pm doesn't like us URL encoding the entire query string such as the equal sign between each paramName and paramValue.
+				// This will be used to set QUERY_STRING in the environment, see build/GS2PerlConstructor.java
+				// Need to also ensure that special characters in param values won't get clobbered on Windows by perl/CGI.pm,
+				// see also https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html
+				// Therefore URL encode CGI param values in the query_string, as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
+		
+				// perl/CGI.pm doesn't like us URL encoding the entire QUERY_STRING such as the equal sign between each paramName and paramValue.
 				// So we URL encode each paramValue separately, which is done in GS2Construct.java::runCommand()
 				querystring.append(paramname + "=" + urlEncodeValue(paramname, paramvalue));
@@ -897,5 +898,8 @@
 		String oldParamVal = paramVal;
 		try{
-			paramVal = URLEncoder.encode(paramVal, StandardCharsets.UTF_8.name());			
+		    paramVal = URLEncoder.encode(paramVal, "UTF-8");			
+		    // Better way as per https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
+		    // but our release kits' Java is too old for importing java.nio.charset.StandardCharsets
+		    //paramVal = URLEncoder.encode(paramVal, StandardCharsets.UTF_8.name());			
 		} catch(UnsupportedEncodingException uee) {
 			logger.warn("**** Unable to encode query_string param " + paramName + " in UTF-8, so attempting to continue with its unencoded value."); // don't output param value to log, in case of sensitive data?
