We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4763f5e commit c2adc5fCopy full SHA for c2adc5f
1 file changed
src/org/owasp/esapi/StringUtilities.java
@@ -27,15 +27,20 @@
27
public class StringUtilities {
28
29
/**
30
- * Removes all unprintable characters from a string for use in an HTTP header
+ * Removes all unprintable characters from a string
31
+ * and replaces with a space for use in an HTTP header
32
* @param input
33
* @return the stripped header
34
*/
35
public static String stripControls( String input ) {
36
StringBuffer sb = new StringBuffer();
37
for ( int i=0; i<input.length(); i++ ) {
38
char c = input.charAt( i );
- if ( c > 0x20 && c < 0x7f ) sb.append( c );
39
+ if ( c > 0x20 && c < 0x7f ) {
40
+ sb.append( c );
41
+ } else {
42
+ sb.append( ' ' );
43
+ }
44
}
45
return sb.toString();
46
0 commit comments