public byte[] getBytes(string inputText)
        {
            byte[]            output    = null;
            String            encoding  = Global.GLOBAL_ENCODING;
            AvailableEncoding aEncoding = AvailableEncodingUtils.getAvailableEncoding(encoding, this.error);

            if (this.HasError())
            {
                return(null);
            }
            String encodingString = AvailableEncodingUtils.valueOf(aEncoding);

            try
            {
                output = AvailableEncodingUtils.encapsulateeGetBytes(inputText, aEncoding, this.error);
                if (this.HasError())
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                this.error.setError("EU001", e.Message);
                return(null);
            }

            this.error.cleanError();
            return(output);
        }
        public string getString(byte[] inputBytes)
        {
            String res      = null;
            String encoding = Global.GLOBAL_ENCODING;

            AvailableEncoding aEncoding = AvailableEncodingUtils.getAvailableEncoding(encoding, this.error);

            if (this.HasError())
            {
                return("");
            }
            String encodingString = AvailableEncodingUtils.valueOf(aEncoding);

            try
            {
                res = AvailableEncodingUtils.encapsulateGetString(inputBytes, aEncoding, this.error).Replace("[\ufffd]", "");
                res = res.Replace("\x00", string.Empty);

                if (this.HasError())
                {
                    return("");
                }
            }
            catch (Exception e)
            {
                this.error.setError("EU002", e.Message);
                return("");
            }
            this.error.cleanError();
            return(res.Trim());
        }
 public void setEncoding(string enc)
 {
     if (AvailableEncodingUtils.existsEncoding(enc))
     {
         Global.GLOBAL_ENCODING = enc;
     }
     else
     {
         this.error.setError("EU003", "set encoding error");
     }
 }