diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF index d4e64d91c5..7067043df5 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin.equinox;singleton:=true -Bundle-Version: 1.3.100.qualifier +Bundle-Version: 1.3.200.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java index 385d348620..7d1c27aa48 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java @@ -338,7 +338,8 @@ void save(EquinoxLauncherData launcherData, boolean backup) throws IOException { // only write the file if we actually have content if (newlines.size() > 0) { - try (BufferedWriter bw = new BufferedWriter(new FileWriter(launcherConfigFile));) { + try (BufferedWriter bw = new BufferedWriter( + new FileWriter(launcherConfigFile, FileUtils.getNativeCharset()));) { for (String arg : newlines) { if (arg == null) continue; diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java index e139ec970d..54cc0e5c38 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java @@ -16,6 +16,7 @@ import java.io.*; import java.net.*; +import java.nio.charset.Charset; import java.util.*; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.URIUtil; @@ -214,9 +215,12 @@ public static URI fromFileURL(String url) throws URISyntaxException { * Loads an ini file, returning a list of all non-blank lines in the file. Like * eclipseConfig.c/readConfigFile() comment lines ('#' its first character) are * skipped too. + * + * This must load the content using the native system encoding because that's + * what the native launcher executable does. */ public static List loadFile(File file) throws IOException { - try (BufferedReader br = new BufferedReader(new FileReader(file));) { + try (BufferedReader br = new BufferedReader(new FileReader(file, getNativeCharset()));) { String line; List list = new ArrayList<>(); while ((line = br.readLine()) != null) { @@ -230,4 +234,13 @@ public static List loadFile(File file) throws IOException { } } + /** + * The encoding used for reading and writing the ini file. This must be the + * native encoding; as of Java 21, the default encoding is UTF-8. + */ + public static Charset getNativeCharset() { + String encoding = System.getProperty("native.encoding"); //$NON-NLS-1$ + return encoding != null ? Charset.forName(encoding) : Charset.defaultCharset(); + } + } diff --git a/features/org.eclipse.equinox.p2.core.feature/feature.xml b/features/org.eclipse.equinox.p2.core.feature/feature.xml index 30ce00ec72..24ce033068 100644 --- a/features/org.eclipse.equinox.p2.core.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.core.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.eclipse.equinox.p2.extras.feature/feature.xml b/features/org.eclipse.equinox.p2.extras.feature/feature.xml index b64c373b84..a8937c9fc4 100644 --- a/features/org.eclipse.equinox.p2.extras.feature/feature.xml +++ b/features/org.eclipse.equinox.p2.extras.feature/feature.xml @@ -2,7 +2,7 @@