diff --git a/src/gab/opencv/OpenCV.java b/src/gab/opencv/OpenCV.java index d3dfd6b..693de3c 100644 --- a/src/gab/opencv/OpenCV.java +++ b/src/gab/opencv/OpenCV.java @@ -41,6 +41,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; +import java.nio.charset.StandardCharsets; import java.io.File; import java.lang.reflect.Field; import java.net.URL; @@ -367,9 +368,14 @@ private void setupWorkingImages(){ private String getLibPath() { URL url = this.getClass().getResource("OpenCV.class"); if (url != null) { - // Convert URL to string, taking care of spaces represented by the "%20" - // string. - String path = url.toString().replace("%20", " "); + String path = ""; + try{ + path = java.net.URLDecoder.decode(url.toString(), StandardCharsets.UTF_8.name()); + } + catch(Exception e){ + //not going to happen - value came from JDK's own StandardCharsets + e.printStackTrace(); + } int n0 = path.indexOf('/'); int n1 = -1;