Skip to content

Commit

Permalink
feat: Added support in the ByteBased read- and write-buffers for WIND…
Browse files Browse the repository at this point in the history
…OWS-1252 encoding
  • Loading branch information
chrisdutz committed Sep 23, 2023
1 parent 77ac465 commit 002da8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -476,6 +476,7 @@ public String readString(String logicalName, int bitLength, WithReaderArgs... re
encoding = encoding.toUpperCase();
switch (encoding) {
case "ASCII":
case "WINDOWS1252":
case "UTF8": {
byte[] strBytes = new byte[bitLength / 8];
int realLength = 0;
Expand All @@ -498,6 +499,9 @@ public String readString(String logicalName, int bitLength, WithReaderArgs... re
case "UTF8":
charset = StandardCharsets.UTF_8;
break;
case "WINDOWS1252":
charset = Charset.forName("windows-1252");
break;
default:
charset = StandardCharsets.US_ASCII;
}
Expand Down
Expand Up @@ -25,6 +25,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class WriteBufferByteBased implements WriteBuffer, BufferCommons {
Expand Down Expand Up @@ -379,6 +380,10 @@ public void writeString(String logicalName, int bitLength, String value, WithWri
bytes = value.getBytes(StandardCharsets.US_ASCII);
break;
}
case "WINDOWS1252": {
bytes = value.getBytes(Charset.forName("windows-1252"));
break;
}
case "UTF8": {
bytes = value.getBytes(StandardCharsets.UTF_8);
break;
Expand Down

0 comments on commit 002da8a

Please sign in to comment.