Utility method for encoding HTML entities within query parameters. @param ch @return
(String source)
| 192 | * @return |
| 193 | */ |
| 194 | static String encodeEntities(String source) { |
| 195 | StringBuffer buffer = new StringBuffer(); |
| 196 | String encoded; |
| 197 | for (int index = 0; index < source.length(); index++) { |
| 198 | char ch = source.charAt(index); |
| 199 | if ((encoded = encodeEntity(ch)) != null) { |
| 200 | buffer.append(encoded); |
| 201 | } else { |
| 202 | buffer.append(ch); |
| 203 | } |
| 204 | } |
| 205 | return buffer.toString(); |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Utility method to encode a string, as per RFC 2396 section 2. Set |
no test coverage detected