This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push:
new 4a8a8d483d Terminal input ignores detected encoding
new 61a38aa3cf Merge pull request #6271 from
matthiasblaesing/inputencoding_terminal
4a8a8d483d is described below
commit 4a8a8d483da73b00f6c635bd555e20b060f5f35f
Author: Matthias Bläsing <[email protected]>
AuthorDate: Sat Jul 29 14:20:21 2023 +0200
Terminal input ignores detected encoding
It was observed that on a german windows installation with JDK 17 the
terminal correctly shows german umlauts, but fails on input.
The terminal subsystem has code to detect the charset used in the
terminal.
Investigation then leads to StreamTerm, where the InputStream for data
coming from the terminal is adapted with the detected charset, while
the user input is ran through an OutputStreamWriter without charset
set. Therefore the user input is encoded with Cp1250 (default on
german windows setups). This leads to garbled input.
The fix applies the same logik, that is already applied to the
InputStream, also to the OutputStream.
---
.../src/org/netbeans/lib/terminalemulator/StreamTerm.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/ide/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/StreamTerm.java
b/ide/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/StreamTerm.java
index 0600ee61c8..1bcb3ac3c5 100644
---
a/ide/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/StreamTerm.java
+++
b/ide/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/StreamTerm.java
@@ -274,7 +274,15 @@ public class StreamTerm extends Term {
updateTtySize();
if (pin != null) {
- outputStreamWriter = new OutputStreamWriter(pin);
+ if(charSet == null) {
+ outputStreamWriter = new OutputStreamWriter(pin);
+ } else {
+ try {
+ outputStreamWriter = new OutputStreamWriter(pin, charSet);
+ } catch (UnsupportedEncodingException ex) {
+ outputStreamWriter = new OutputStreamWriter(pin);
+ }
+ }
stdinMonitor = new InputMonitor(outputStreamWriter);
addInputListener(stdinMonitor);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists