-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
Support letters other than A-Z in identifiers in SpEL expressions #30580
Comments
Try ExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("'你好,世界!'");
String message = (String) expression.getValue();
System.out.println(message); // Prints "你好,世界!" |
@k143408, your example demonstrates SpEL's support for Chinese characters within a Whereas, @changyoutianxia's example uses Chinese characters in a property name (i.e., a getter method in the root context object). |
Prior to this commit, when an unsupported character such as "ü" was encountered in a SpEL expression, the error message was: Cannot handle (252) 'ü' With this commit, the error message is now similar to: Unsupported character 'ü' (252) encountered at position 5 in expression. See spring-projectsgh-30580 Closes spring-projectsgh-30602
This is a known (although undocumented) limitation of SpEL. Specifically, the SpEL parser imposes the following restrictions on identifiers (property names, field names, and variable names).
With regard to letters, only the letters Since this limitation has been in place since SpEL was introduced, we do not plan to modify the current behavior for Spring Framework 6.0.x or previous versions of the framework. However, we will modify the SpEL |
Affects: Spring Framework 5.3.13
SpEL does not support Chinese.
Example:
The text was updated successfully, but these errors were encountered: