1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

use UTF-8 as default encoding in the Terminal (#1020)

the rest of Eclipse now uses UTF-8 as default encoding.

The tm.terminal code reverts to null when the encoding
begins with "Default" and this leads to UTF-8 being
selected from Charset.defaultEncoding instead of ISO-8859
when the displayed default value is selected.

Co-authored-by: Philipp SALZGEBER <philipp.salzgeber@bachmann.info>
This commit is contained in:
astrograph 2025-01-17 15:25:06 +01:00 committed by GitHub
parent 8d0642568c
commit 3439e0e7e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 20 additions and 11 deletions

View file

@ -52,6 +52,15 @@ The View Performance preference page, which is CDT specific, has been relocated
This only affects where in the Preferences tree the page is located, the preferences and key names have not changed.
In addition, this page is always visible.
# Terminal
## Default encoding for terminal is now UTF-8
For a [while](https://eclipse.dev/eclipse/news/4.24/platform.html#explicit-encoding-workspaces), the default encoding in Eclipse has been UTF-8.
Starting in CDT 12, the Terminal will now default to UTF-8.
<p align="center"><img src="images/CDT-12.0-default-terminal-encoding.png"></p>
# API Changes, current and planned
## Breaking API changes

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -232,7 +232,7 @@ public class SshWizardConfigurationPanel extends AbstractExtendedConfigurationPa
if (encoding == null || "null".equals(encoding)) { //$NON-NLS-1$
String defaultEncoding = getSelectionEncoding();
encoding = defaultEncoding != null && !"".equals(defaultEncoding.trim()) ? defaultEncoding.trim() //$NON-NLS-1$
: "ISO-8859-1"; //$NON-NLS-1$
: "UTF-8"; //$NON-NLS-1$
}
setEncoding(encoding);
} else {

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2018, 2024 Contributors to the Eclipse Foundation
# Copyright (c) 2018, 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
@ -24,7 +24,7 @@ blurb=TM Terminal Control\n\
Version: {featureVersion}\n\
Build id: {0}\n\
\n\
Copyright (c) 2018, 2024 Contributors to the Eclipse Foundation
Copyright (c) 2018, 2025 Contributors to the Eclipse Foundation
\n\
See the NOTICE file(s) distributed with this work for additional\n\
information regarding copyright ownership.\n\

View file

@ -1210,7 +1210,7 @@ public class VT100Emulator implements ControlListener {
}
try {
terminal.getOutputStream().write(reply.getBytes("ISO-8859-1")); //$NON-NLS-1$
terminal.getOutputStream().write(reply.getBytes("UTF-8")); //$NON-NLS-1$
terminal.getOutputStream().flush();
} catch (IOException ex) {
Logger.log("Caught IOException!"); //$NON-NLS-1$

View file

@ -61,7 +61,7 @@ public class TerminalConnectorFactoryTest extends TestCase {
@Override
public String getEncoding() {
return "ISO-8859-1"; //$NON-NLS-1$
return "UTF-8"; //$NON-NLS-1$
}
@Override

View file

@ -61,7 +61,7 @@ public class TerminalConnectorTest extends TestCase {
@Override
public String getEncoding() {
return "ISO-8859-1"; //$NON-NLS-1$
return "UTF-8"; //$NON-NLS-1$
}
@Override

View file

@ -537,7 +537,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
List<String> encodings = new ArrayList<>();
// Default encoding
encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
encodings.add("Default (UTF-8)"); //$NON-NLS-1$
// The currently selected IDE encoding from the preferences
String ideEncoding = getResourceEncoding();
@ -612,7 +612,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
Assert.isNotNull(encoding);
if (encodingCombo != null && !encodingCombo.isDisposed()) {
int index = encodingCombo.indexOf("ISO-8859-1".equals(encoding) ? "Default (ISO-8859-1)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
int index = encodingCombo.indexOf("UTF-8".equals(encoding) ? "Default (UTF-8)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
if (index != -1)
encodingCombo.select(index);
else {
@ -642,7 +642,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
protected boolean isEncodingValid() {
try {
String encoding = getEncoding();
return Charset.isSupported(encoding != null ? encoding : "ISO-8859-1"); //$NON-NLS-1$
return Charset.isSupported(encoding != null ? encoding : "UTF-8"); //$NON-NLS-1$
} catch (IllegalCharsetNameException e) {
return false;
}

View file

@ -833,8 +833,8 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
buffer.append(" - "); //$NON-NLS-1$
String encoding = terminal.getEncoding();
if (encoding == null || "ISO-8859-1".equals(encoding)) { //$NON-NLS-1$
encoding = "Default (ISO-8859-1)"; //$NON-NLS-1$
if (encoding == null || "UTF-8".equals(encoding)) { //$NON-NLS-1$
encoding = "Default (UTF-8)"; //$NON-NLS-1$
}
buffer.append(NLS.bind(Messages.TabFolderManager_encoding, encoding));