Skip to content

Commit 927fa15

Browse files
authored
CLDR-16192 Admin email encoding failure for non-ASCII text (#2599)
-Simply return parameter unchanged for WebContext.decodeFieldString -Comments
1 parent 9258c90 commit 927fa15

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

tools/cldr-apps/src/main/java/org/unicode/cldr/web/WebContext.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -291,34 +291,18 @@ public String field(String x, String def) {
291291
}
292292

293293
/*
294-
* Decode a single string from URL format into Unicode
294+
* Return the input string, unchanged
295295
*
296-
* @param res UTF-8 'encoded' bytes (expanded to a string)
296+
* This method no longer serves any purpose since CLDR now requires UTF-8 encoding
297+
* for all http requests and related services/configuration.
297298
*
298-
* @return Unicode string (will return 'res' if no high bits were detected)
299+
* This method is temporarily retained for compatibility with legacy code including .jsp.
300+
*
301+
* @param res the string
302+
*
303+
* @return the string
299304
*/
300305
public static String decodeFieldString(String res) {
301-
if (res == null)
302-
return null;
303-
byte[] asBytes = new byte[res.length()];
304-
boolean wasHigh = false;
305-
int n;
306-
for (n = 0; n < res.length(); n++) {
307-
asBytes[n] = (byte) (res.charAt(n) & 0x00FF);
308-
// println(" n : " + (int)asBytes[n] + " .. ");
309-
if (asBytes[n] < 0) {
310-
wasHigh = true;
311-
}
312-
}
313-
if (!wasHigh) {
314-
return res; // no utf-8
315-
}
316-
try {
317-
res = new String(asBytes, StandardCharsets.UTF_8);
318-
} catch (Throwable t) {
319-
return res;
320-
}
321-
322306
return res;
323307
}
324308

0 commit comments

Comments
 (0)