-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Extend the characters allowed for selectors #454
Comments
The default character that are allowed for selectors are "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-". This is by design. // Create a list of all Cyrillic characters
var cyrillicChars = new List<char>();
for (var c = '\u0400'; c <= '\u04FF'; c++)
{
cyrillicChars.Add(c);
}
for (var c = '\u0500'; c <= '\u052F'; c++)
{
cyrillicChars.Add(c);
}
var settings = new SmartSettings();
settings.Parser.AddCustomSelectorChars(cyrillicChars);
var formatter = Smart.CreateDefaultSmartFormat(settings); With this extension, your sample will work. Might be an enhancement to remove the valid character set, and just exclude specific reserved characters. |
@karljj1 What do you think about extending the valid characters for selectors in general? |
That's a good idea, especially when dealing with localization. Id expect any character to work for a selector except those that have other functions. |
@axunonb That works perfectly well, it solved the issue. Thank you! |
@vdachev-david Using a numeric index is already implemented, but you mean a string index here |
Hello! Using the latest version of SmartFormat, I encountered an issue, where my template cannot be processed when it contains Cyrillic letters.
The code:
The error:
Unexpected Error: The format string has 5 issues:
'0x421': Invalid character in the selector, '0x43E': Invalid character in the selector, '0x444': Invalid character in the selector, '0x438': Invalid character in the selector, '0x44F': Invalid character in the selector
In: "{ArchiveAttributes[София].DisplayText}"
At: -------------------^^^^^
However, when I change the following part to contain only English, it works perfectly well:
I am unsure if I am missing something, or if it is genuinely a bug.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: