[libbluray-devel] [Git][videolan/libbluray][master] Fix using default encoding

Petri Hintukainen gitlab at videolan.org
Fri Feb 22 17:17:06 CET 2019


Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
0f26e1e0 by Petri Hintukainen at 2019-02-22T16:15:54Z
Fix using default encoding

- - - - -


2 changed files:

- src/libbluray/bdj/java/org/videolan/Libbluray.java
- src/libbluray/bdj/java/org/videolan/mmbd/Adapter.java


Changes:

=====================================
src/libbluray/bdj/java/org/videolan/Libbluray.java
=====================================
@@ -238,9 +238,14 @@ public class Libbluray {
         }
 
         byte[] type = getAacsData(4096);
-        String pkg = type != null ? new String(type) : null;
-        if (pkg != null) {
-            System.out.println("using " + pkg);
+        String pkg;
+        try {
+            pkg = type != null ? new String(type, "UTF-8") : null;
+            if (pkg != null) {
+                System.out.println("using " + pkg);
+            }
+        } catch (java.io.UnsupportedEncodingException uee) {
+            pkg = null;
         }
 
         System.setProperty("mhp.profile.enhanced_broadcast", "YES");


=====================================
src/libbluray/bdj/java/org/videolan/mmbd/Adapter.java
=====================================
@@ -71,8 +71,13 @@ public class Adapter extends LoaderAdapter implements BDJClassLoaderAdapter {
         final String s2 = "org/videolan/mmbd/Adapter$If";
         Map m = new HashMap();
         String d1, d2;
-        m.put(s1, d1 = (new String(b0) + new String(b1)));
-        m.put(s2, d2 = (new String(b0) + new String(b2)));
+
+        try {
+            m.put(s1, d1 = (new String(b0, "UTF-8") + new String(b1, "UTF-8")));
+            m.put(s2, d2 = (new String(b0, "UTF-8") + new String(b2, "UTF-8")));
+        } catch (java.io.UnsupportedEncodingException uee) {
+            throw new ClassNotFoundException();
+        }
 
         BDJClassFileTransformer t = new BDJClassFileTransformer();
         byte[] c1 = t.rename(loadBootClassCode(s1), m);



View it on GitLab: https://code.videolan.org/videolan/libbluray/commit/0f26e1e0327b9a89559cf5db98d1d3022162d3c8

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/commit/0f26e1e0327b9a89559cf5db98d1d3022162d3c8
You're receiving this email because of your account on code.videolan.org.


More information about the libbluray-devel mailing list