]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/engine/HtmlEntry.java
Restore Android 10 API compatibility.
[Dictionary.git] / src / com / hughes / android / dictionary / engine / HtmlEntry.java
index 87a3172d0ddfae929136001f6dff673474a18842..7aa43d5340d41d2f8153b8b479957e59a04ffe04 100644 (file)
@@ -213,7 +213,11 @@ public class HtmlEntry extends AbstractEntry implements Comparable<HtmlEntry> {
     public static String formatQuickdicUrl(final String indexShortName, final String text) {
         assert !indexShortName.contains(":");
         assert text.length() > 0;
-        return String.format("q://d?%s&%s", indexShortName, StringUtil.encodeForUrl(text));
+        StringBuilder s = new StringBuilder("q://d?");
+        s.append(indexShortName);
+        s.append("&");
+        s.append(StringUtil.encodeForUrl(text));
+        return s.toString();
     }
 
     public static boolean isQuickdicUrl(String url) {
@@ -263,7 +267,8 @@ public class HtmlEntry extends AbstractEntry implements Comparable<HtmlEntry> {
             buf.readFully(zipBytes);
             try {
                 final byte[] bytes = StringUtil.unzipFully(zipBytes, numBytes);
-                html = new String(bytes, StandardCharsets.UTF_8);
+                // Cannot use StandardCharsets due to older Android.
+                html = new String(bytes, "UTF-8");
             } catch (IOException e) {
                 throw new RuntimeException("Dictionary HTML data corrupted", e);
             }