--- /RFC1522Codec.java	2023-07-05 02:19:52.166120815 +0200
+++ /Codec-1/src/java/org/apache/commons/codec/net/RFC1522Codec.java	2023-07-05 02:19:52.166120815 +0200
@@ -109,7 +109,7 @@
         if ((to == -1) || (to == termnator)) {
             throw new DecoderException("RFC 1522 violation: charset token not found");
         }
-        String charset = text.substring(from, to);
+String charset = encoding.substring ( from, to ) ;
         if (charset.equals("")) {
             throw new DecoderException("RFC 1522 violation: charset not specified");
         }
