Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-7402 test round trip string repr, standard charset refs

dev747368c24160d092f4
diff --git a/Ghidra/Debug/Debugger-rmi-trace/ghidra_scripts/TerminalGhidraScript.java b/Ghidra/Debug/Debugger-rmi-trace/ghidra_scripts/TerminalGhidraScript.java
index 68b351aa79..2e38ea65b6 100644
--- a/Ghidra/Debug/Debugger-rmi-trace/ghidra_scripts/TerminalGhidraScript.java
+++ b/Ghidra/Debug/Debugger-rmi-trace/ghidra_scripts/TerminalGhidraScript.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@@ -41,7 +41,7 @@ public class TerminalGhidraScript extends GhidraScript {
TerminalService terminalService = ensureTerminalService();
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- try (Terminal term = terminalService.createWithStreams(Charset.forName("UTF-8"),
+ try (Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream())) {
term.addTerminalListener(new TerminalListener() {
@Override
diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java
index 56aa1ada77..ae1083ea7f 100644
--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java
+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java
@@ -18,7 +18,7 @@ package ghidra.app.plugin.core.debug.gui.tracermi.launcher;
import java.io.File;
import java.io.IOException;
import java.net.*;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.*;
@@ -473,7 +473,7 @@ public abstract class AbstractTraceRmiLaunchOffer implements TraceRmiLaunchOffer
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- Terminal terminal = terminalService.createWithStreams(plugin, Charset.forName("UTF-8"),
+ Terminal terminal = terminalService.createWithStreams(plugin, StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream());
List<String> withoutPath = ShellUtils.removePath(commandLine);
@@ -536,7 +536,7 @@ public abstract class AbstractTraceRmiLaunchOffer implements TraceRmiLaunchOffer
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- Terminal terminal = terminalService.createWithStreams(plugin, Charset.forName("UTF-8"),
+ Terminal terminal = terminalService.createWithStreams(plugin, StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream());
TerminalListener resizeListener = new TerminalListener() {
@Override
diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java
index 5cd95584c5..3d29854f69 100644
--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java
+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/address/DBTraceOverlaySpaceAdapter.java
@@ -19,6 +19,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.locks.ReadWriteLock;
@@ -67,7 +68,7 @@ public class DBTraceOverlaySpaceAdapter implements DBTraceManager {
*/
public static class AddressDBFieldCodec<OT extends DBAnnotatedObject & DecodesAddresses>
extends AbstractDBFieldCodec<Address, OT, FixedField10> {
- static final Charset UTF8 = Charset.forName("UTF-8");
+ static final Charset UTF8 = StandardCharsets.UTF_8;
public static byte[] encode(Address address) {
if (address == null) {
diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java
index 6b7deedb5a..ac7b213f89 100644
--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java
+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java
@@ -21,8 +21,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
@@ -575,7 +575,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {
* @return the buffer, positioned at 0
*/
public ByteBuffer buf(String str) {
- CharsetEncoder ce = Charset.forName("UTF-8").newEncoder();
+ CharsetEncoder ce = StandardCharsets.UTF_8.newEncoder();
ByteBuffer result =
ByteBuffer.allocate(Math.round(ce.maxBytesPerChar() * str.length()) + 1);
ce.encode(CharBuffer.wrap(str), result, true);
diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStoreFactory.java b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStoreFactory.java
index 8986eeaf2b..7011b067c7 100644
--- a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStoreFactory.java
+++ b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStoreFactory.java
@@ -914,7 +914,7 @@ public class DBCachedObjectStoreFactory {
new SimplePrimitiveCodec<>(Long.class, ByteBuffer::getLong, ByteBuffer::putLong);
/** Codec for {@link String} */
PrimitiveCodec<String> STRING = new AbstractPrimitiveCodec<>(String.class) {
- final Charset cs = Charset.forName("UTF-8");
+ final Charset cs = StandardCharsets.UTF_8;
@Override
public String decode(ByteBuffer buffer) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/GhidraSourceBundle.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/GhidraSourceBundle.java
index 944fc290f8..4c8b8bafd8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/GhidraSourceBundle.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/GhidraSourceBundle.java
@@ -20,7 +20,7 @@ import static java.util.stream.Collectors.*;
import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.*;
import java.util.Map.Entry;
@@ -977,7 +977,7 @@ public class GhidraSourceBundle extends GhidraBundle {
Path activatorSourceFileName = bindir.resolve(activatorClassName + ".java");
try (PrintWriter activatorWriter = new PrintWriter(
- Files.newBufferedWriter(activatorSourceFileName, Charset.forName("UTF-8")))) {
+ Files.newBufferedWriter(activatorSourceFileName, StandardCharsets.UTF_8))) {
activatorWriter.println("import " + GhidraBundleActivator.class.getName() + ";");
activatorWriter.println("import org.osgi.framework.BundleActivator;");
activatorWriter.println("import org.osgi.framework.BundleContext;");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataRoot.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataRoot.java
index 46942c9e1b..03e44a74fa 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataRoot.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataRoot.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,7 @@
package ghidra.app.util.bin.format.pe.cli;
import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import ghidra.app.util.bin.BinaryReader;
@@ -85,7 +85,7 @@ public class CliMetadataRoot implements StructConverter, PeMarkupable {
this.versionLength = reader.readNextInt();
if (versionLength > 0 && versionLength < NTHeader.MAX_SANE_COUNT) {
this.version =
- new String(reader.readNextByteArray(this.versionLength), Charset.forName("UTF-8"));
+ new String(reader.readNextByteArray(this.versionLength), StandardCharsets.UTF_8);
}
this.flags = reader.readNextShort();
this.streamsCount = reader.readNextShort();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/PCodeTestAbstractControlBlock.java b/Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/PCodeTestAbstractControlBlock.java
index eacb96725f..1a8d168d23 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/PCodeTestAbstractControlBlock.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/PCodeTestAbstractControlBlock.java
@@ -15,7 +15,7 @@
*/
package ghidra.test.processors.support;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import ghidra.app.util.PseudoDisassembler;
@@ -427,7 +427,7 @@ public abstract class PCodeTestAbstractControlBlock {
offset += charSize;
++index;
}
- return new String(buffer, 0, index, Charset.forName("ASCII"));
+ return new String(buffer, 0, index, StandardCharsets.US_ASCII);
}
protected long emuRead(PcodeThread<byte[]> emu, Address addr, int size) {
diff --git a/Ghidra/Features/MicrosoftDmang/src/main/java/mdemangler/MDMang.java b/Ghidra/Features/MicrosoftDmang/src/main/java/mdemangler/MDMang.java
index e0df9e067e..055d47d38f 100644
--- a/Ghidra/Features/MicrosoftDmang/src/main/java/mdemangler/MDMang.java
+++ b/Ghidra/Features/MicrosoftDmang/src/main/java/mdemangler/MDMang.java
@@ -16,6 +16,7 @@
package mdemangler;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -531,8 +532,8 @@ public class MDMang {
/******************************************************************************/
/******************************************************************************/
// SPECIALIZATION METHODS
- private static final Charset UTF8 = Charset.forName("UTF-8");
- private static final Charset UTF16 = Charset.forName("UTF-16");
+ private static final Charset UTF8 = StandardCharsets.UTF_8;
+ private static final Charset UTF16 = StandardCharsets.UTF_16;
// private static final Charset WIN1252 = Charset.forName("windows-1252");
public void insert(StringBuilder builder, MDString mdstring) {
diff --git a/Ghidra/Features/SystemEmulation/ghidra_scripts/DebuggerEmuExampleScript.java b/Ghidra/Features/SystemEmulation/ghidra_scripts/DebuggerEmuExampleScript.java
index 99b75fb282..9bf6f9c573 100644
--- a/Ghidra/Features/SystemEmulation/ghidra_scripts/DebuggerEmuExampleScript.java
+++ b/Ghidra/Features/SystemEmulation/ghidra_scripts/DebuggerEmuExampleScript.java
@@ -24,6 +24,7 @@
//@toolbar
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler;
@@ -55,7 +56,7 @@ import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.TraceTimeManager;
public class DebuggerEmuExampleScript extends GhidraScript implements FlatDebuggerAPI {
- private final static Charset UTF8 = Charset.forName("utf8");
+ private final static Charset UTF8 = StandardCharsets.UTF_8;
@Override
protected void run() throws Exception {
diff --git a/Ghidra/Features/SystemEmulation/ghidra_scripts/DemoSyscallLibrary.java b/Ghidra/Features/SystemEmulation/ghidra_scripts/DemoSyscallLibrary.java
index 6387126d98..f1fdf43d62 100644
--- a/Ghidra/Features/SystemEmulation/ghidra_scripts/DemoSyscallLibrary.java
+++ b/Ghidra/Features/SystemEmulation/ghidra_scripts/DemoSyscallLibrary.java
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import ghidra.app.script.GhidraScript;
@@ -56,7 +57,7 @@ import ghidra.program.model.listing.Program;
* it will borrow many conventions from Linux-amd64.
*/
public class DemoSyscallLibrary extends AnnotatedEmuSyscallUseropLibrary<byte[]> {
- private final static Charset UTF8 = Charset.forName("utf8");
+ private final static Charset UTF8 = StandardCharsets.UTF_8;
private final GhidraScript script;
diff --git a/Ghidra/Features/SystemEmulation/ghidra_scripts/StandAloneSyscallEmuExampleScript.java b/Ghidra/Features/SystemEmulation/ghidra_scripts/StandAloneSyscallEmuExampleScript.java
index 72958f0e85..3e6c22a75e 100644
--- a/Ghidra/Features/SystemEmulation/ghidra_scripts/StandAloneSyscallEmuExampleScript.java
+++ b/Ghidra/Features/SystemEmulation/ghidra_scripts/StandAloneSyscallEmuExampleScript.java
@@ -22,6 +22,7 @@
//@toolbar
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler;
@@ -46,7 +47,7 @@ import ghidra.program.model.mem.MemoryBlock;
import ghidra.program.model.symbol.SourceType;
public class StandAloneSyscallEmuExampleScript extends GhidraScript {
- private final static Charset UTF8 = Charset.forName("utf8");
+ private final static Charset UTF8 = StandardCharsets.UTF_8;
Program program = null;
diff --git a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/EmulatorUtilities.java b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/EmulatorUtilities.java
index 51e5adb8e8..e111add3d0 100644
--- a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/EmulatorUtilities.java
+++ b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/EmulatorUtilities.java
@@ -18,8 +18,7 @@ package ghidra.pcode.emu;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
+import java.nio.charset.*;
import java.util.Arrays;
import java.util.NoSuchElementException;
@@ -381,6 +380,6 @@ public enum EmulatorUtilities {
* @return the decoded string
*/
public static String decodeNullTerminatedString(PcodeExecutorState<?> state, Address ptr) {
- return decodeNullTerminatedString(state, ptr, Charset.forName("ASCII"), 128);
+ return decodeNullTerminatedString(state, ptr, StandardCharsets.US_ASCII, 128);
}
}
diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java
index eceff3b529..c3ac27a62f 100644
--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java
+++ b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import com.microsoft.win32.*;
@@ -118,7 +119,7 @@ public class ConPtyChild extends ConPtyEndpoint implements PtyChild {
Shell shell = isImplicitCmd(args) ? Shell.WINDOWS_CMD : Shell.WINDOWS;
String commandLine = ShellUtils.generateLine(Arrays.asList(args), shell);
- Charset utf16le = Charset.forName("UTF-16LE");
+ Charset utf16le = StandardCharsets.UTF_16LE;
Win32Err.checkFalse(win32_h.CreateProcessW(cs,
MemorySegment.NULL, // lpApplicationName
arena.allocateFrom(commandLine, utf16le), // lpCommandLine
diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/Win32Err.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/Win32Err.java
index f984b7cb92..1e90fd522f 100644
--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/Win32Err.java
+++ b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/Win32Err.java
@@ -17,7 +17,7 @@ package ghidra.pty.windows;
import java.lang.foreign.*;
import java.lang.invoke.VarHandle;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import com.microsoft.win32.win32_h;
@@ -60,7 +60,7 @@ public interface Win32Err {
byte[] managed = new byte[lenBytes];
MemorySegment.copy(unmanaged, ValueLayout.JAVA_BYTE, 0, managed, 0, lenBytes);
win32_h.LocalFree(unmanaged);
- return new String(managed, Charset.forName("UTF-16LE"));
+ return new String(managed, StandardCharsets.UTF_16LE);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ConstantPool.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ConstantPool.java
index f8c92e6714..8cb6678c5f 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ConstantPool.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ConstantPool.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,7 @@ import static ghidra.program.model.pcode.AttributeId.*;
import static ghidra.program.model.pcode.ElementId.*;
import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import ghidra.program.model.data.DataType;
import ghidra.program.model.pcode.Encoder;
@@ -113,7 +113,7 @@ public abstract class ConstantPool {
}
public void setUTF8Data(String val) {
- byteData = val.getBytes(Charset.forName("UTF-8"));
+ byteData = val.getBytes(StandardCharsets.UTF_8);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/util/charset/CharsetInfoManager.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/util/charset/CharsetInfoManager.java
index 85f9ad6043..6d29f08bd5 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/util/charset/CharsetInfoManager.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/util/charset/CharsetInfoManager.java
@@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.*;
import java.io.*;
import java.lang.Character.UnicodeScript;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import com.google.gson.*;
@@ -62,14 +63,6 @@ public class CharsetInfoManager {
private static CharsetInfoManager INSTANCE = new CharsetInfoManager();
}
- private static final class CharSetsSingleton {
- // decouple loading these 'non-standard' (but actually standard) charsets to a different
- // class so their initialization can happen before the manager singleton instance
- private static final Charset UTF_32 = Charset.forName(UTF32);
- private static final Charset UTF_32LE = Charset.forName("UTF-32LE");
- private static final Charset UTF_32BE = Charset.forName("UTF-32BE");
- }
-
/**
* Get the global singleton instance of this {@link CharsetInfoManager}.
* <p>
@@ -231,9 +224,9 @@ public class CharsetInfoManager {
new CharsetInfo(UTF_16BE.name(), null, 2, 4, 2, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
new CharsetInfo(UTF_16LE.name(), null, 2, 4, 2, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
- new CharsetInfo(CharSetsSingleton.UTF_32.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
- new CharsetInfo(CharSetsSingleton.UTF_32BE.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
- new CharsetInfo(CharSetsSingleton.UTF_32LE.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
+ new CharsetInfo(StandardCharsets.UTF_32.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
+ new CharsetInfo(UTF_32BE.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
+ new CharsetInfo(UTF_32LE.name(), null, 4, 4, 4, -1, true, true, CharsetInfo.ALL_SCRIPTS, Set.of()),
new CharsetInfo(ISO_8859_1.name(), null, 1, 1, 1, -1, true, false, EnumSet.of(COMMON, LATIN), Set.of(USASCII))
);
diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/DialogResourceDataTypeTest.java b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/DialogResourceDataTypeTest.java
index 4f0c61f098..25437d506d 100644
--- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/DialogResourceDataTypeTest.java
+++ b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/DialogResourceDataTypeTest.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,9 +15,9 @@
*/
package ghidra.program.model.data;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.junit.Before;
import org.junit.Test;
@@ -25,9 +25,7 @@ import org.junit.Test;
import generic.test.AbstractGTest;
import ghidra.program.model.address.AddressSpace;
import ghidra.program.model.address.GenericAddressSpace;
-import ghidra.program.model.mem.ByteMemBufferImpl;
-import ghidra.program.model.mem.MemBuffer;
-import ghidra.program.model.mem.MemoryAccessException;
+import ghidra.program.model.mem.*;
import ghidra.util.LittleEndianDataConverter;
public class DialogResourceDataTypeTest extends AbstractGTest {
@@ -51,7 +49,7 @@ public class DialogResourceDataTypeTest extends AbstractGTest {
assertEquals("Dialog Title", titleComponent.getFieldName());
byte[] titleBytes = new byte[titleComponent.getLength() - 2]; // cut off the null terminator
mb.getBytes(titleBytes, titleComponent.getOffset());
- String title = new String(titleBytes, Charset.forName("UTF-16LE"));
+ String title = new String(titleBytes, StandardCharsets.UTF_16LE);
assertEquals("Test Dialog", title);
DataTypeComponent sizeComponent = components[4];
@@ -62,7 +60,7 @@ public class DialogResourceDataTypeTest extends AbstractGTest {
assertEquals("Dialog Font Typeface", typefaceComponent.getFieldName());
byte[] typefaceBytes = new byte[typefaceComponent.getLength() - 2]; // cut off the null terminator
mb.getBytes(typefaceBytes, typefaceComponent.getOffset());
- String typeface = new String(typefaceBytes, Charset.forName("UTF-16LE"));
+ String typeface = new String(typefaceBytes, StandardCharsets.UTF_16LE);
assertEquals("Test Typeface", typeface);
}
@@ -78,7 +76,7 @@ public class DialogResourceDataTypeTest extends AbstractGTest {
assertEquals("Dialog Title", titleComponent.getFieldName());
byte[] titleBytes = new byte[titleComponent.getLength() - 2]; // cut off the null terminator
mb.getBytes(titleBytes, titleComponent.getOffset());
- String title = new String(titleBytes, Charset.forName("UTF-16LE"));
+ String title = new String(titleBytes, StandardCharsets.UTF_16LE);
assertEquals("Test Dialog", title);
DataTypeComponent sizeComponent = components[4];
@@ -101,7 +99,7 @@ public class DialogResourceDataTypeTest extends AbstractGTest {
assertEquals("Dialog Font Typeface", typefaceComponent.getFieldName());
byte[] typefaceBytes = new byte[typefaceComponent.getLength() - 2]; // cut off the null terminator
mb.getBytes(typefaceBytes, typefaceComponent.getOffset());
- String typeface = new String(typefaceBytes, Charset.forName("UTF-16LE"));
+ String typeface = new String(typefaceBytes, StandardCharsets.UTF_16LE);
assertEquals("Test Typeface", typeface);
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringDataTypeTest.java b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringDataTypeTest.java
index 8ab171f31b..673574dcb7 100644
--- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringDataTypeTest.java
+++ b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringDataTypeTest.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -72,6 +72,18 @@ public class StringDataTypeTest extends AbstractGTest {
return new StringDataInstance(dt, settings, buf, length);
}
+ private void assertRoundTripRepr(MemBuffer mb, int length, AbstractStringDataType dt,
+ Settings settings, String expectedRepr) throws DataTypeEncodeException {
+ byte[] origBytes = new byte[length];
+ mb.getBytes(origBytes, 0);
+
+ String repr = dt.getRepresentation(mb, settings, length);
+ assertEquals(expectedRepr, repr);
+
+ byte[] roundTripBytes = dt.encodeRepresentation(repr, mb, settings, length);
+ assertArrayEquals(origBytes, roundTripBytes);
+ }
+
//-------------------------------------------------------------------------------------
// get string length
//-------------------------------------------------------------------------------------
@@ -634,6 +646,39 @@ public class StringDataTypeTest extends AbstractGTest {
}
+ @Test
+ public void testStringReprRoundTrip() throws DataTypeEncodeException {
+ ByteMemBufferImpl buf = mb(false, 'h', 'e', 'l', 'l', 'o', 0, 'a', '\n', 'b', 255, 0);
+
+ assertRoundTripRepr(buf, buf.getLength(), fixedlenString, newset(),
+ "\"hello\\0a\\nb\",FFh");
+
+ // "ab" and 2 ideographic characters cc01 & 1202 encoded as UTF-8
+ buf = mb(false, 'a', 'b', 0xec, 0xb0, 0x81, 0xe1, 0x88, 0x82);
+ assertRoundTripRepr(buf, buf.getLength(), fixedUtf8String, newset().set(RENDER_ENUM.ALL),
+ "u8\"ab\ucc01\u1202\"");
+
+ // test "Hello " U+1f600 emoji (\ud83d \ude00) encoded as utf-8
+ buf = mb(false, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0xf0, 0x9f, 0x98, 0x80);
+ assertRoundTripRepr(buf, buf.getLength(), fixedUtf8String, newset().set(RENDER_ENUM.ALL),
+ "u8\"Hello \ud83d\ude00\"");
+
+ // test "Hello " U+1f600 emoji (\ud83d \ude00) "!" encoded as utf-16
+ // tests handling real codepoint in the repr string, not an escaped code point
+ buf = mb(false, 0x48, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x20, 0x00,
+ 0x3d, 0xd8, 0x00, 0xde, 0x21, 0x00);
+ assertRoundTripRepr(buf, buf.getLength(), fixedUtf16String, newset().set(RENDER_ENUM.ALL),
+ "u\"Hello \ud83d\ude00!\"");
+
+ // also test round tripping full escaped code point value:
+ assertRoundTripRepr(buf, buf.getLength(), fixedUtf16String,
+ newset().set(RENDER_ENUM.ESC_SEQ), "u\"Hello \\U0001F600!\"");
+
+ // also test round tripping byte-coded code point value:
+ assertRoundTripRepr(buf, buf.getLength(), fixedUtf16String,
+ newset().set(RENDER_ENUM.BYTE_SEQ), "u\"Hello \",3Dh,D8h,00h,DEh,\"!\"");
+ }
+
//-------------------------------------------------------------------------------------
// StringDataInstance.isMissingNullTerminator()
//-------------------------------------------------------------------------------------
diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringRenderBuilderTest.java b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringRenderBuilderTest.java
index 7ac8e5aef9..d164f02497 100644
--- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringRenderBuilderTest.java
+++ b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/data/StringRenderBuilderTest.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ public class StringRenderBuilderTest extends AbstractGTest {
private static final Charset US_ASCII = StandardCharsets.US_ASCII;
private static final Charset UTF8 = StandardCharsets.UTF_8;
private static final Charset UTF16 = StandardCharsets.UTF_16;
- private static final Charset UTF32 = Charset.forName("UTF-32");
+ private static final Charset UTF32 = StandardCharsets.UTF_32;
private ByteBuffer bb(int... values) {
return ByteBuffer.wrap(bytes(values));
@@ -239,8 +239,8 @@ public class StringRenderBuilderTest extends AbstractGTest {
// This probably isn't a big deal as BOMs aren't used frequently (?)
ByteBuffer bb =
bb(0xff, 0xfe, 0, 0, 't', 0, 0, 0, 'e', 0, 0, 0, 's', 0, 0, 0, 't', 0, 0, 0);
- StringRenderBuilder srb = new StringRenderBuilder(Charset.forName("UTF-32LE"), 4,
- StringRenderBuilder.DOUBLE_QUOTE);
+ StringRenderBuilder srb =
+ new StringRenderBuilder(StandardCharsets.UTF_32LE, 4, StringRenderBuilder.DOUBLE_QUOTE);
srb.decodeBytesUsingCharset(bb, RENDER_ENUM.ALL, true);
String s = srb.build();
assertEquals("U\"test\"", s);
diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java
index 2df50940e4..1dba99f521 100644
--- a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java
+++ b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidraclass/debugger/screenshot/TutorialDebuggerScreenShots.java
@@ -21,7 +21,7 @@ import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.MouseEvent;
import java.io.*;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.util.*;
@@ -253,7 +253,7 @@ public class TutorialDebuggerScreenShots extends GhidraScreenShotGenerator
pty.getChild().session(new String[] { TERMMINES_PATH }, Map.of("TERM", "xterm-256color"));
PtyParent parent = pty.getParent();
try (Terminal terminal =
- terminalService.createWithStreams(Charset.forName("utf8"), parent.getInputStream(),
+ terminalService.createWithStreams(StandardCharsets.UTF_8, parent.getInputStream(),
parent.getOutputStream())) {
TerminalProvider provider = waitForComponentProvider(TerminalProvider.class);
diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/AbstractRmiConnectorsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/AbstractRmiConnectorsTest.java
index b645dc303c..e4535fb9bf 100644
--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/AbstractRmiConnectorsTest.java
+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/AbstractRmiConnectorsTest.java
@@ -15,14 +15,13 @@
*/
package agent;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
import java.io.*;
import java.lang.annotation.*;
import java.lang.reflect.Method;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
@@ -126,7 +125,7 @@ public abstract class AbstractRmiConnectorsTest
throw new NullPointerException("Terminal Service is not installed in test tool");
}
try (Pty pty = PtyFactory.local().openpty();
- Terminal term = terminalService.createWithStreams(Charset.forName("utf8"),
+ Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
pty.getParent().getInputStream(), pty.getParent().getOutputStream())) {
PtySession session = pty.getChild().session(command.toArray(String[]::new), env);
return session.waitExited();
diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/DefinedStringsPluginScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/DefinedStringsPluginScreenShots.java
index ce3c583cfe..739081bbd1 100644
--- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/DefinedStringsPluginScreenShots.java
+++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/DefinedStringsPluginScreenShots.java
@@ -15,7 +15,6 @@
*/
package help.screenshot;
-import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import javax.swing.table.TableColumn;
@@ -58,7 +57,7 @@ public class DefinedStringsPluginScreenShots extends GhidraScreenShotGenerator {
"Roses are \u001b[0;31mred\u001b[0m, violets are \u001b[0;34mblue. Hope you enjoy terminal hue",
StandardCharsets.US_ASCII, true, StringDataType.dataType);
- Data tempDegrees = builder.createString("0x500", "Temp \u2103", Charset.forName("UTF-32LE"),
+ Data tempDegrees = builder.createString("0x500", "Temp \u2103", StandardCharsets.UTF_32LE,
true, Unicode32DataType.dataType);
builder.withTransaction(() -> {
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java
index 0b39d353eb..6cfb1a02ad 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java
@@ -20,7 +20,7 @@ import static org.junit.Assume.*;
import java.io.File;
import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.*;
@@ -68,7 +68,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
clipboardService = addPlugin(tool, ClipboardPlugin.class);
env.showFrontEndTool();
- try (Terminal term = terminalService.createNullTerminal(Charset.forName("utf8"), out -> {
+ try (Terminal term = terminalService.createNullTerminal(StandardCharsets.UTF_8, out -> {
out.reset();
})) {
term.injectDisplayOutput(b);
@@ -86,7 +86,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
clipboardService = addPlugin(tool, ClipboardPlugin.class);
env.showFrontEndTool();
- try (Terminal term = terminalService.createNullTerminal(Charset.forName("utf8"), out -> {
+ try (Terminal term = terminalService.createNullTerminal(StandardCharsets.UTF_8, out -> {
out.reset();
})) {
term.injectDisplayOutput(b);
@@ -116,7 +116,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- try (Terminal term = terminalService.createWithStreams(Charset.forName("UTF-8"),
+ try (Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream())) {
term.addTerminalListener(new TerminalListener() {
@Override
@@ -150,7 +150,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- try (Terminal term = terminalService.createWithStreams(Charset.forName("UTF-8"),
+ try (Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream())) {
term.addTerminalListener(new TerminalListener() {
@Override
@@ -181,7 +181,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
PtyParent parent = pty.getParent();
PtyChild child = pty.getChild();
- try (Terminal term = terminalService.createWithStreams(Charset.forName("UTF-8"),
+ try (Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream())) {
term.addTerminalListener(new TerminalListener() {
@Override
@@ -211,7 +211,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
pty.getChild().session(new String[] { "C:\\Windows\\system32\\cmd.exe" }, env);
PtyParent parent = pty.getParent();
- try (Terminal term = terminalService.createWithStreams(Charset.forName("UTF-8"),
+ try (Terminal term = terminalService.createWithStreams(StandardCharsets.UTF_8,
parent.getInputStream(), parent.getOutputStream())) {
term.setFixedSize(80, 25);
session.waitExited();
@@ -233,7 +233,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -265,7 +265,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -297,7 +297,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -326,7 +326,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -358,7 +358,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -387,7 +387,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -425,7 +425,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -463,7 +463,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -495,7 +495,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -527,7 +527,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -565,7 +565,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);
term.injectDisplayOutput(TEST_CONTENTS);
@@ -599,7 +599,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(40, 25);
@@ -627,7 +627,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(40, 25);
@@ -654,7 +654,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(40, 25);
@@ -680,7 +680,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(40, 25);
@@ -706,7 +706,7 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
terminalService = addPlugin(tool, TerminalPlugin.class);
try (DefaultTerminal term = (DefaultTerminal) terminalService
- .createNullTerminal(Charset.forName("UTF-8"), buf -> {
+ .createNullTerminal(StandardCharsets.UTF_8, buf -> {
})) {
term.setFixedSize(80, 25);