Changeset 33043 for main/trunk
- Timestamp:
- 2019-04-30T18:33:42+12:00 (5 years ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/resources/tomcat/server_tomcat8.xml.svn
r32696 r33043 70 70 port="@localhost.port.http@" protocol="HTTP/1.1" 71 71 connectionTimeout="20000" 72 redirectPort="@https.redirect.port@" /> 72 redirectPort="@https.redirect.port@" 73 URIEncoding="UTF-8" /> 73 74 --> 74 75 <!-- A "Connector" using the shared thread pool--> … … 96 97 <!-- 97 98 <Connector port="@https.redirect.port@" protocol="org.apache.coyote.http11.Http11NioProtocol" 98 maxThreads="150" SSLEnabled="true" >99 maxThreads="150" SSLEnabled="true" URIEncoding="UTF-8"> 99 100 <SSLHostConfig> 100 101 <Certificate certificateKeystoreFile="conf/localhost-rsa.jks" … … 111 112 <!-- 112 113 <Connector port="@https.redirect.port@" protocol="org.apache.coyote.http11.Http11AprProtocol" 113 maxThreads="150" SSLEnabled="true" >114 maxThreads="150" SSLEnabled="true" URIEncoding="UTF-8" > 114 115 <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> 115 116 <SSLHostConfig> … … 127 128 keystorePass="@keystore.pass@" 128 129 clientAuth="false" sslProtocol="TLS" 129 keystoreType="@keystore.type@" /> 130 keystoreType="@keystore.type@" 131 URIEncoding="UTF-8" /> 130 132 @https.comment.out.end@ 131 133 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r32942 r33043 43 43 44 44 import org.greenstone.gsdl3.util.MyNodeList; 45 import org.greenstone.util.Misc; 46 45 47 /** various functions for extracting info out of GS XML */ 46 48 public class GSXML … … 1629 1631 } 1630 1632 1631 public static String elementToString(Element e, boolean indent) 1633 // pass in debugEncoding=true to investigate encoding issues. This function will then return non-basic ASCII characters in hex 1634 public static String elementToString(Element e, boolean indent, boolean debugEncoding) 1632 1635 { 1633 1636 String str = ""; … … 1647 1650 trans.transform(new DOMSource(e), new StreamResult(sw)); 1648 1651 str += sw.toString(); 1652 1653 // if debugging encoding issues, then encode unicode code pts as hex for all but non-alphanumeric and space/tab/newline chars 1654 if(debugEncoding) str = Misc.stringToHex(str); 1649 1655 } 1650 1656 catch (Exception ex) … … 1658 1664 } 1659 1665 1666 public static String elementToString(Element e, boolean indent) 1667 { 1668 return elementToString(e, indent, false); 1669 } 1670 1660 1671 public static ArrayList<String> getGroupsFromSecurityResponse(Element securityResponse) 1661 1672 { -
main/trunk/greenstone3/src/java/org/greenstone/util/Misc.java
r32608 r33043 56 56 } 57 57 } 58 58 59 60 // Debugging function to print a string's non-basic chars in hex 61 // Based on https://stackoverflow.com/questions/923863/converting-a-string-to-hexadecimal-in-java 62 public static String stringToHex(String str) { 63 String result = ""; 64 for(int i = 0; i < str.length(); i++) { 65 int charCode = str.codePointAt(i); // unicode codepoint / ASCII code 66 67 // ASCII table: https://cdn.sparkfun.com/assets/home_page_posts/2/1/2/1/ascii_table_black.png 68 // If the unicode character code pt is less than the ASCII code for space and greater than for tilda, let's display the char in hex (x0000 format) 69 if((charCode >= 20 && charCode <= 126) || charCode == 9 || charCode == 10 || charCode == 13) { // space to tilda, TAB, LF, CR are printable 70 result += str.charAt(i); 71 } else { 72 result += "x" + String.format("%04x", charCode); 73 } 74 } 75 76 return result; 77 } 78 79 59 80 public static void printHash(HashMap map) { 60 81 Set entries = map.entrySet(); -
main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
r32893 r33043 11 11 { 12 12 return $("#" + id.replace(/\./g, "\\.").replace(/:/g,"\\:")); 13 } 14 15 // Debugging function to print a string's non-basic chars in hex 16 // Based on https://stackoverflow.com/questions/36637146/javascript-encode-string-to-hex/36637293 17 // https://stackoverflow.com/questions/21647928/javascript-unicode-string-to-hex 18 gs.functions.string2hex = function(str) { 19 var hex, i; 20 21 var result = ""; 22 for (i=0; i<str.length; i++) { 23 charcode = str.charCodeAt(i); 24 // ASCII table: https://cdn.sparkfun.com/assets/home_page_posts/2/1/2/1/ascii_table_black.png 25 // if the unicode character code pt is less than the ASCII code for space and greater than for tilda, let's display the char in hex (x0000 format) 26 if(charcode < 20 || charcode > 126) { //doesn't work: if(str.charAt(i) < ' ' || str.charAt(i) > '~') { 27 hex = charcode.toString(16); 28 result += "x" + ("000"+hex).slice(-4); 29 } 30 else { 31 result += str.charAt(i); 32 } 33 } 34 35 return result; 13 36 } 14 37
Note:
See TracChangeset
for help on using the changeset viewer.