diff --git a/README.md b/README.md index eede71489..793dee8d5 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Here are some projects that use tm4e: * [Eclipse aCute](https://github.com/eclipse/aCute) C# edition in Eclipse IDE. * [LiClipseText](http://www.liclipse.com/text/) enables Eclipse to be used as a general-purpose text editor, providing support for several languages out of the box. * [typescript.java](https://github.com/angelozerr/typescript.java) TypeScript IDE for Eclipse with JSDT & tsserver. + * [EditorConfig for Eclipse](https://github.com/angelozerr/ec4e) EditorConfig for Eclipse with GenericEditor. ## Get support and contribute diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java index 15664c64e..a527d214b 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java @@ -18,7 +18,7 @@ package org.eclipse.tm4e.core.internal.oniguruma; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import org.jcodings.specific.UTF8Encoding; import org.joni.Matcher; @@ -44,12 +44,7 @@ public OnigRegExp(String source) { lastSearchStrUniqueId = null; lastSearchPosition = -1; lastSearchResult = null; - byte[] pattern; - try { - pattern = source.getBytes("utf-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } + byte[] pattern = source.getBytes(StandardCharsets.UTF_8); this.regex = new Regex(pattern, 0, pattern.length, Option.CAPTURE_GROUP, UTF8Encoding.INSTANCE, Syntax.DEFAULT, WarnCallback.DEFAULT); } diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java index 53c3ea18f..e93355b31 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigString.java @@ -18,10 +18,10 @@ package org.eclipse.tm4e.core.internal.oniguruma; -import java.nio.charset.Charset; import java.util.Arrays; import org.jcodings.specific.UTF8Encoding; +import java.nio.charset.StandardCharsets; /** * Oniguruma string. @@ -31,8 +31,6 @@ */ public class OnigString { - private static final String UTF_8 = "UTF-8"; - private final String str; private final Object uniqueId; private final byte[] value; @@ -43,7 +41,7 @@ public class OnigString { public OnigString(String str) { this.str = str; - this.value = str.getBytes(Charset.forName(UTF_8)); + this.value = str.getBytes(StandardCharsets.UTF_8); this.uniqueId = new Object(); } diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java index fa079df66..4878d65c4 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/parser/json/JSONPListParser.java @@ -13,6 +13,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import org.eclipse.tm4e.core.internal.parser.PList; @@ -29,7 +30,7 @@ public JSONPListParser(boolean theme) { public T parse(InputStream contents) throws Exception { PList pList = new PList(theme); - JsonReader reader = new JsonReader(new InputStreamReader(contents, Charset.forName("UTF-8"))); + JsonReader reader = new JsonReader(new InputStreamReader(contents, StandardCharsets.UTF_8)); // reader.setLenient(true); boolean parsing = true; while (parsing) {