I made ScriptRuntime.escapeString to escape \ and remove code to escape single quote ' as it is unreachable due to if (' ' <= c && c <= '~' && c != '"' && c != '\\') check as ' should not be escaped.
git-svn-id: svn://10.0.0.236/trunk@135242 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
6b977246aa
commit
06f9755b5e
@ -368,8 +368,9 @@ public class ScriptRuntime {
|
||||
for(int i = 0, L = s.length(); i != L; ++i) {
|
||||
int c = s.charAt(i);
|
||||
|
||||
if (' ' <= c && c <= '~' && c != '"') {
|
||||
if (' ' <= c && c <= '~' && c != '"' && c != '\\') {
|
||||
// an ordinary print character (like C isprint()) and not "
|
||||
// or \ . Note single quote ' is not escaped
|
||||
if (sb != null) {
|
||||
sb.append((char)c);
|
||||
}
|
||||
@ -391,7 +392,7 @@ public class ScriptRuntime {
|
||||
case 0xb: escape = 'v'; break; // Java lacks \v.
|
||||
case '"': escape = '"'; break;
|
||||
case ' ': escape = ' '; break;
|
||||
case '\'': escape = '\''; break;
|
||||
case '\\': escape = '\\'; break;
|
||||
}
|
||||
if (escape >= 0) {
|
||||
// an \escaped sort of character
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user