Skip to content

Commit 3439e0e

Browse files
authored
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>
1 parent 8d06425 commit 3439e0e

File tree

9 files changed

+20
-11
lines changed

9 files changed

+20
-11
lines changed

NewAndNoteworthy/CDT-12.0.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ The View Performance preference page, which is CDT specific, has been relocated
5252
This only affects where in the Preferences tree the page is located, the preferences and key names have not changed.
5353
In addition, this page is always visible.
5454

55+
# Terminal
56+
57+
## Default encoding for terminal is now UTF-8
58+
59+
For a [while](https://eclipse.dev/eclipse/news/4.24/platform.html#explicit-encoding-workspaces), the default encoding in Eclipse has been UTF-8.
60+
Starting in CDT 12, the Terminal will now default to UTF-8.
61+
62+
<p align="center"><img src="images/CDT-12.0-default-terminal-encoding.png"></p>
63+
5564
# API Changes, current and planned
5665

5766
## Breaking API changes
Loading

terminal/plugins/org.eclipse.tm.terminal.connector.ssh/src/org/eclipse/tm/terminal/connector/ssh/controls/SshWizardConfigurationPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected void fillSettingsForHost(String host) {
232232
if (encoding == null || "null".equals(encoding)) { //$NON-NLS-1$
233233
String defaultEncoding = getSelectionEncoding();
234234
encoding = defaultEncoding != null && !"".equals(defaultEncoding.trim()) ? defaultEncoding.trim() //$NON-NLS-1$
235-
: "ISO-8859-1"; //$NON-NLS-1$
235+
: "UTF-8"; //$NON-NLS-1$
236236
}
237237
setEncoding(encoding);
238238
} else {

terminal/plugins/org.eclipse.tm.terminal.control/about.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2018, 2024 Contributors to the Eclipse Foundation
2+
# Copyright (c) 2018, 2025 Contributors to the Eclipse Foundation
33
#
44
# See the NOTICE file(s) distributed with this work for additional
55
# information regarding copyright ownership.
@@ -24,7 +24,7 @@ blurb=TM Terminal Control\n\
2424
Version: {featureVersion}\n\
2525
Build id: {0}\n\
2626
\n\
27-
Copyright (c) 2018, 2024 Contributors to the Eclipse Foundation
27+
Copyright (c) 2018, 2025 Contributors to the Eclipse Foundation
2828
\n\
2929
See the NOTICE file(s) distributed with this work for additional\n\
3030
information regarding copyright ownership.\n\

terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100Emulator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ private void processAnsiCommand_n() {
12101210
}
12111211

12121212
try {
1213-
terminal.getOutputStream().write(reply.getBytes("ISO-8859-1")); //$NON-NLS-1$
1213+
terminal.getOutputStream().write(reply.getBytes("UTF-8")); //$NON-NLS-1$
12141214
terminal.getOutputStream().flush();
12151215
} catch (IOException ex) {
12161216
Logger.log("Caught IOException!"); //$NON-NLS-1$

terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void setCharset(Charset charset) {
6161

6262
@Override
6363
public String getEncoding() {
64-
return "ISO-8859-1"; //$NON-NLS-1$
64+
return "UTF-8"; //$NON-NLS-1$
6565
}
6666

6767
@Override

terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void setCharset(Charset charset) {
6161

6262
@Override
6363
public String getEncoding() {
64-
return "ISO-8859-1"; //$NON-NLS-1$
64+
return "UTF-8"; //$NON-NLS-1$
6565
}
6666

6767
@Override

terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/panels/AbstractExtendedConfigurationPanel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ protected void fillEncodingCombo() {
537537
List<String> encodings = new ArrayList<>();
538538

539539
// Default encoding
540-
encodings.add("Default (ISO-8859-1)"); //$NON-NLS-1$
540+
encodings.add("Default (UTF-8)"); //$NON-NLS-1$
541541

542542
// The currently selected IDE encoding from the preferences
543543
String ideEncoding = getResourceEncoding();
@@ -612,7 +612,7 @@ protected void setEncoding(String encoding) {
612612
Assert.isNotNull(encoding);
613613

614614
if (encodingCombo != null && !encodingCombo.isDisposed()) {
615-
int index = encodingCombo.indexOf("ISO-8859-1".equals(encoding) ? "Default (ISO-8859-1)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
615+
int index = encodingCombo.indexOf("UTF-8".equals(encoding) ? "Default (UTF-8)" : encoding); //$NON-NLS-1$ //$NON-NLS-2$
616616
if (index != -1)
617617
encodingCombo.select(index);
618618
else {
@@ -642,7 +642,7 @@ protected String getEncoding() {
642642
protected boolean isEncodingValid() {
643643
try {
644644
String encoding = getEncoding();
645-
return Charset.isSupported(encoding != null ? encoding : "ISO-8859-1"); //$NON-NLS-1$
645+
return Charset.isSupported(encoding != null ? encoding : "UTF-8"); //$NON-NLS-1$
646646
} catch (IllegalCharsetNameException e) {
647647
return false;
648648
}

terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabFolderManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,8 @@ public final void updateStatusLine() {
833833
buffer.append(" - "); //$NON-NLS-1$
834834

835835
String encoding = terminal.getEncoding();
836-
if (encoding == null || "ISO-8859-1".equals(encoding)) { //$NON-NLS-1$
837-
encoding = "Default (ISO-8859-1)"; //$NON-NLS-1$
836+
if (encoding == null || "UTF-8".equals(encoding)) { //$NON-NLS-1$
837+
encoding = "Default (UTF-8)"; //$NON-NLS-1$
838838
}
839839
buffer.append(NLS.bind(Messages.TabFolderManager_encoding, encoding));
840840

0 commit comments

Comments
 (0)