mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 19:24:15 +00:00
Support for unicode characters starting with \U
This commit is contained in:
parent
1b3c08a433
commit
714fb81330
3 changed files with 4 additions and 2 deletions
|
@ -9,7 +9,7 @@ import java.util.regex.Pattern;
|
|||
class StringConverter implements ValueConverter {
|
||||
|
||||
static final StringConverter STRING_PARSER = new StringConverter();
|
||||
private static final Pattern UNICODE_REGEX = Pattern.compile("\\\\u(.*)");
|
||||
private static final Pattern UNICODE_REGEX = Pattern.compile("\\\\[uU](.*)");
|
||||
|
||||
@Override
|
||||
public boolean canConvert(String s) {
|
||||
|
|
|
@ -77,6 +77,7 @@ public class StringTest {
|
|||
Toml toml = new Toml().parse(new File(getClass().getResource("should_support_special_characters_in_strings.toml").getFile()));
|
||||
|
||||
assertEquals("more or less ±", toml.getString("unicode_key"));
|
||||
assertEquals("more or less ±", toml.getString("unicode_key_uppercase"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
key = "\" \t \n \r \\ \/ \b \f"
|
||||
unicode_key = "more or less \u00B1"
|
||||
unicode_key = "more or less \u00B1"
|
||||
unicode_key_uppercase = "more or less \U00B1"
|
||||
|
|
Loading…
Reference in a new issue