mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 573797: Use the user selected encoding when intercepting byte stream
Change-Id: Id64ba9218a626d9daec02ef3a7480a67e802b865
This commit is contained in:
parent
d465e83836
commit
49d29dc6ae
2 changed files with 4 additions and 8 deletions
|
@ -339,11 +339,8 @@ public class InputStreamMonitor extends OutputStream implements IDisposable {
|
|||
Assert.isNotNull(bytes);
|
||||
|
||||
if (replacement != NO_CHANGE && len > 0) {
|
||||
String origText = new String(bytes, off, len);
|
||||
String origText = new String(bytes, off, len, terminalControl.getCharset());
|
||||
String text = null;
|
||||
//
|
||||
// TODO: check whether this is correct! new String(byte[], int, int) always uses the default
|
||||
// encoding!
|
||||
|
||||
if (replacement == CHANGE_CR_TO_LF) {
|
||||
text = origText.replace('\r', '\n');
|
||||
|
@ -356,7 +353,7 @@ public class InputStreamMonitor extends OutputStream implements IDisposable {
|
|||
}
|
||||
|
||||
if (text != null && !origText.equals(text)) {
|
||||
bytes = text.getBytes();
|
||||
bytes = text.getBytes(terminalControl.getCharset());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -274,8 +274,7 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
// Remember if the text got changed.
|
||||
boolean changed = false;
|
||||
|
||||
// How can me make sure that we don't mess with the encoding here?
|
||||
String text = new String(byteBuffer, 0, bytesRead);
|
||||
String text = new String(byteBuffer, 0, bytesRead, terminalControl.getCharset());
|
||||
|
||||
// Shift-In (14) and Shift-Out(15) confuses the terminal widget
|
||||
if (text.indexOf(14) != -1 || text.indexOf(15) != -1) {
|
||||
|
@ -312,7 +311,7 @@ public class OutputStreamMonitor implements IDisposable {
|
|||
|
||||
// If changed, get the new bytes array
|
||||
if (changed) {
|
||||
byteBuffer = text.getBytes();
|
||||
byteBuffer = text.getBytes(terminalControl.getCharset());
|
||||
bytesRead = byteBuffer.length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue