Code first
@Test
public void tryUnicode()
{
SpelExpressionParser parser = new SpelExpressionParser();
Object rootObject = new Object()
{
public String getName()
{
return "wener";
}
public String get名字()
{
return getName();
}
};
// ok
assert parser.parseExpression("name").getValue(rootObject).equals("wener");
// not ok
assert parser.parseExpression("名字").getValue(rootObject).equals("wener");
}
Some time we just need a unicode name, it is more friendly to our custom in template. SpEL is simple ,easy and built-in, I don't want to use another EL solution, how can I solve this problem ?
EDIT
In org.springframework.expression.spel.standard.Tokenizer#isIdentifier
, they only accept isAlphabetic(ch) || isDigit(ch) || ch == '_' || ch == '$';
no unicode support, but java identifier allowed unicode, sad.