Skip to content

Commit 3fe11bf

Browse files
committed
Fixes #61, "Invalid unicode" errors
1 parent 12c9c35 commit 3fe11bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/src/main/java/org/jd/gui/service/sourcesaver/ClassFileSourceSaverProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@ public void saveContent(API api, Controller controller, Listener listener, Path
110110
// Metadata
111111
if (getPreferenceValue(p, WRITE_METADATA, true)) {
112112
// Add location
113+
String location =
114+
new File(entry.getUri()).getPath()
115+
// Escape "\ u" sequence to prevent "Invalid unicode" errors
116+
.replaceAll("(^|[^\\\\])\\\\u", "\\\\\\\\u");
113117
ps.print("\n\n/* Location: ");
114-
ps.print(new File(entry.getUri()).getPath());
118+
ps.print(location);
115119
// Add Java compiler version
116120
int majorVersion = printer.getMajorVersion();
117121

0 commit comments

Comments
 (0)