Skip to content

Commit

Permalink
Merge pull request #24817 from kaido207/fix_nonascii_encode
Browse files Browse the repository at this point in the history
Fixes #24816 Non-ASCII characters are not saved correctly in JVM options added using the JVM Options page
  • Loading branch information
arjantijms authored Feb 20, 2024
2 parents bb3e535 + 4aa239c commit 7a65c43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -277,7 +278,7 @@ public static void saveRealm(HandlerContext handlerCtx) {
continue;
}
sb.append(oneProp.get("name")).append("=");
String value = ((String) oneProp.get("value")).replaceAll("\\\\", "\\\\\\\\");
String value = (String) oneProp.get("value");
value = UtilHandlers.escapePropertyValue(value);
sb.append(value).append(":");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -1094,19 +1095,7 @@ public static String escapePropertyValue(String str){
builder.append(ch);
break;
default:
// Check if we should unicode escape this...
if ((ch > 0x7e) || (ch < 0x20)) {
builder.append("\\u");
chStr = Integer.toHexString(ch);
len = chStr.length();
for (int idx=4; idx > len; idx--) {
// Add leading 0's
builder.append('0');
}
builder.append(chStr);
} else {
builder.append(ch);
}
builder.append(ch);
break;
}
ch = it.next();
Expand Down

0 comments on commit 7a65c43

Please sign in to comment.