|
17 | 17 | import org.eclipse.core.resources.IResource; |
18 | 18 | import org.eclipse.core.resources.ResourcesPlugin; |
19 | 19 | import org.eclipse.core.runtime.CoreException; |
| 20 | +import org.eclipse.core.runtime.Platform; |
20 | 21 | import org.eclipse.core.runtime.Preferences; |
21 | 22 | import org.eclipse.debug.core.DebugPlugin; |
22 | 23 | import org.eclipse.debug.core.ILaunchConfiguration; |
@@ -60,21 +61,20 @@ protected String getDefaultEncoding() { |
60 | 61 | */ |
61 | 62 | public void testGetSystemDefaultEncoding() throws CoreException { |
62 | 63 | String oldencoding = ResourcesPlugin.getEncoding(); |
63 | | - String oldsystemencoding = System.getProperty("file.encoding"); |
| 64 | + String defaultEncoding = getDefaultEncoding(); |
| 65 | + String systemEncoding = Platform.getSystemCharset().name(); |
64 | 66 | try { |
65 | | - getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, getDefaultEncoding()); |
66 | | - System.setProperty("file.encoding", "UTF-16BE"); |
| 67 | + getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, defaultEncoding); |
67 | 68 | ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); |
68 | 69 | assertNotNull("the configuration could not be found", config); |
69 | 70 | assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) == null); |
70 | 71 | String encoding = getLaunchManager().getEncoding(config); |
71 | 72 | assertNotNull("The configuration encoding should not be null", encoding); |
72 | | - assertEquals("The configuration encoding should match the file system encoding", encoding, System.getProperty("file.encoding")); |
| 73 | + assertEquals("The configuration encoding should match the file system encoding", systemEncoding, encoding); |
73 | 74 | } |
74 | 75 | finally { |
75 | 76 | //ensure old encoding is restored |
76 | | - getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, (oldencoding == null ? getDefaultEncoding() : oldencoding)); |
77 | | - System.setProperty("file.encoding", oldsystemencoding); |
| 77 | + getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, (oldencoding == null ? defaultEncoding : oldencoding)); |
78 | 78 | } |
79 | 79 | } |
80 | 80 |
|
|
0 commit comments