IllegalArgumentException: Bad escape for Chinese characters in
FileObject path #168.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java
index fce79ac..1f5e2d2 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java
@@ -307,7 +307,7 @@
* @since 2.7.0
*/
default URI getURI() {
- return URI.create(getName().getURI());
+ return URI.create(URI.create(getName().getURI()).toASCIIString());
}
/**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeChartInPathTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeChartInPathTest.java
index 8419dcc..66ab4b3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeChartInPathTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileObjectEscapeChartInPathTest.java
@@ -34,10 +34,8 @@
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.function.FailableFunction;
import org.apache.commons.vfs2.impl.StandardFileSystemManager;
-import org.junit.Ignore;
import org.junit.Test;
-@Ignore
public class FileObjectEscapeChartInPathTest {
private static final String REL_PATH_GREAT = "src/test/resources/test-data/好.txt";
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cac0154..56c4001 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,6 +56,9 @@
<action type="fix" dev="ggregory" due-to="Boris Petrov, Gary Gregory, Max Kellermann">
Fix NPE when closing a stream from a different thread #167. See also #166.
</action>
+ <action type="fix" dev="ggregory" issue="VFS-798" due-to="XenoAmess, Gary Gregory">
+ IllegalArgumentException: Bad escape for Chinese characters in FileObject path #168.
+ </action>
<!-- UPDATES -->
<action type="update" dev="ggregory" due-to="Arturo Bernal">
Replace construction of FileInputStream and FileOutputStream objects with Files NIO APIs. #164.