We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 91a897d + ee5a1c9 commit 68d413eCopy full SHA for 68d413e
common/src/format.rs
@@ -869,7 +869,7 @@ impl FormatString {
869
let mut left = String::new();
870
871
// There may be one layer nesting brackets in spec
872
- for (idx, c) in text.chars().enumerate() {
+ for (idx, c) in text.char_indices() {
873
if idx == 0 {
874
if c != '{' {
875
return Err(FormatParseError::MissingStartBracket);
@@ -1076,6 +1076,11 @@ mod tests {
1076
assert_eq!(FormatString::from_str("abcd{1}:{key}"), expected);
1077
}
1078
1079
+ #[test]
1080
+ fn test_format_parse_multi_byte_char() {
1081
+ assert!(FormatString::from_str("{a:%ЫйЯЧ}").is_ok());
1082
+ }
1083
+
1084
#[test]
1085
fn test_format_parse_fail() {
1086
assert_eq!(
0 commit comments