diff --git a/src/main/java/com/moandjiezana/toml/StringConverter.java b/src/main/java/com/moandjiezana/toml/StringConverter.java index a72fb4a..05acfe7 100644 --- a/src/main/java/com/moandjiezana/toml/StringConverter.java +++ b/src/main/java/com/moandjiezana/toml/StringConverter.java @@ -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) { diff --git a/src/test/java/com/moandjiezana/toml/StringTest.java b/src/test/java/com/moandjiezana/toml/StringTest.java index 91f2f48..dbea85c 100644 --- a/src/test/java/com/moandjiezana/toml/StringTest.java +++ b/src/test/java/com/moandjiezana/toml/StringTest.java @@ -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) diff --git a/src/test/resources/com/moandjiezana/toml/should_support_special_characters_in_strings.toml b/src/test/resources/com/moandjiezana/toml/should_support_special_characters_in_strings.toml index 48e4fc5..a12b0ac 100644 --- a/src/test/resources/com/moandjiezana/toml/should_support_special_characters_in_strings.toml +++ b/src/test/resources/com/moandjiezana/toml/should_support_special_characters_in_strings.toml @@ -1,2 +1,3 @@ key = "\" \t \n \r \\ \/ \b \f" -unicode_key = "more or less \u00B1" \ No newline at end of file +unicode_key = "more or less \u00B1" +unicode_key_uppercase = "more or less \U00B1"