-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode Decoding in String/Char Literal Evaluation #113
Conversation
Improve error message for method invocation on null.
…g a script without local member declaration
…to string, and can not be successfully retrieved by outer layers
corrected junit library version number in eclipse .classpath file Fix provided by Andrea Curtoni
Thanks for making a pull request! This reminds me to add a "code of conduct", still on my buckt list :( Two things before I proceed:
Another thing - do you know this repro: https://github.com/beanshell/beanshell? |
public void parse_unicode_literals_in_comment() throws Exception { | ||
final Interpreter interpreter = new Interpreter(); | ||
Object result = interpreter.eval("// source path: C:\\user\\desktop"); | ||
Assert.assertEquals(result, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case one (dedicated method)
Object result = interpreter.eval("// source path: C:\\user\\desktop"); | ||
Assert.assertEquals(result, null); | ||
char c = (char) interpreter.eval("return '\\u51ea\'"); | ||
Assert.assertEquals(c, '\u51ea'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case two (dedicated method)
Assert.assertEquals(c, '\u51ea'); | ||
String s = (String) interpreter.eval("return \"\\u51EA1234\"; // \\user\\desktop"); | ||
System.out.println(s); | ||
Assert.assertEquals(s, "\u51EA1234"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case three (dedicated method)
Yeah, I know the repo https://github.com/beanshell/beanshell . Therefore, I also opened the issue about it. There are many enhancement in other repo than this one. But, this one has a large version number of release product. I don't know what this repo has, but anthoer don't. Our product uses 2.1.x version, so there is a problem to update. Althrough @stain, @nickl- , etc. fixed some bugs in their repo, I prefer this repo to work with Eclipse IDE. It has more convenient to develop, experiment and build. If all of you can decide how to merge into a repository, and create a complete environment for build flow and introduce what's kind of IDE you used, it will be more maintainers I think. |
Maybe we should limit some syntax problem. Please look at https://stackoverflow.com/questions/30727515/why-is-executing-java-code-in-comments-with-certain-unicode-characters-allowed |
Superseded by #114 |
@morris821028 pong! Missed this thread but perhaps #110 is more appropriate for a response from me. @pejobo please see response there... |
This patch is used to avoid the content of comment make it failed in parser. According to #112 , there is a solution which move the unicode decode part of
readchar()
intostringSetup
andcharSetup
.