philmasterplus
Active member
When JavaScript code is executed with the gCLI
In contrast, the
Example in the gCLI:
The special-casing code is at line 336 of
This can be easily fixed by special-casing the
Attached is a patch file containing the fix.
js
command, the entire string is processed with CharacterEntities.unescape()
before being passed to the JavaScript interpreter. While this behavior is standard for most gCLI commands, it makes debugging JS one-liners difficult.In contrast, the
ash
command is special-cased to receive HTML entities as is. It would be nice to give the js
command the same treatment.Example in the gCLI:
Code:
> ash "&".length()
Returned: 5
> js "&".length
Returned: 1
The special-casing code is at line 336 of
KoLmafiaCLI.java
:
Java:
// Pass through escaped character entities to ASH
if ( !line.startsWith( "ash" ) )
{
line = CharacterEntities.unescape( line );
}
This can be easily fixed by special-casing the
js
command, too:
Java:
// Pass through escaped character entities to ASH and JS
if ( !(line.startsWith( "ash" ) || line.startsWith( "js" )) )
{
line = CharacterEntities.unescape( line );
}
Attached is a patch file containing the fix.