Support for unicode characters starting with \U

This commit is contained in:
moandji.ezana 2014-12-15 16:02:49 +02:00
parent 1b3c08a433
commit 714fb81330
3 changed files with 4 additions and 2 deletions

View file

@ -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) {

View file

@ -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)

View file

@ -1,2 +1,3 @@
key = "\" \t \n \r \\ \/ \b \f"
unicode_key = "more or less \u00B1"
unicode_key_uppercase = "more or less \U00B1"