Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use UTF-8 as default encoding #1020

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions NewAndNoteworthy/CDT-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected void fillSettingsForHost(String host) {
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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ private void processAnsiCommand_n() {
}

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$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setCharset(Charset charset) {

@Override
public String getEncoding() {
return "ISO-8859-1"; //$NON-NLS-1$
return "UTF-8"; //$NON-NLS-1$
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setCharset(Charset charset) {

@Override
public String getEncoding() {
return "ISO-8859-1"; //$NON-NLS-1$
return "UTF-8"; //$NON-NLS-1$
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ protected void fillEncodingCombo() {
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();
Expand Down Expand Up @@ -612,7 +612,7 @@ protected void setEncoding(String encoding) {
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 {
Expand Down Expand Up @@ -642,7 +642,7 @@ protected String getEncoding() {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,8 @@ public final void updateStatusLine() {
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));

Expand Down
Loading