From 3fe11bf2c97823cbaba60b305338bc44a993daa5 Mon Sep 17 00:00:00 2001 From: emmanue1 Date: Wed, 12 Aug 2015 20:19:05 +0200 Subject: [PATCH] Fixes #61, "Invalid unicode" errors --- .../service/sourcesaver/ClassFileSourceSaverProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/jd/gui/service/sourcesaver/ClassFileSourceSaverProvider.java b/services/src/main/java/org/jd/gui/service/sourcesaver/ClassFileSourceSaverProvider.java index f688b2e7..28ec4d06 100644 --- a/services/src/main/java/org/jd/gui/service/sourcesaver/ClassFileSourceSaverProvider.java +++ b/services/src/main/java/org/jd/gui/service/sourcesaver/ClassFileSourceSaverProvider.java @@ -110,8 +110,12 @@ public void saveContent(API api, Controller controller, Listener listener, Path // Metadata if (getPreferenceValue(p, WRITE_METADATA, true)) { // Add location + String location = + new File(entry.getUri()).getPath() + // Escape "\ u" sequence to prevent "Invalid unicode" errors + .replaceAll("(^|[^\\\\])\\\\u", "\\\\\\\\u"); ps.print("\n\n/* Location: "); - ps.print(new File(entry.getUri()).getPath()); + ps.print(location); // Add Java compiler version int majorVersion = printer.getMajorVersion();