Kbase P118288: Result of BASE64-ENCODE returns extra characters
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/08/2006 |
|
Status: Unverified
SYMPTOM(s):
Using BASE64-ENCODE function
Using code similar to:
DEFINE VARIABLE rwData AS RAW NO-UNDO.
DEFINE VARIABLE cEncode AS CHARACTER NO-UNDO.
PUT-STRING(rwdata, 1) = "abc".
cEncode = BASE64-ENCODE(rwdata).
Messaging cEncode results in:
YWJjAA==
Websites offering BASE64 encoding tests return:
YWJj
LENGTH(cEncode) returns 8
No matter what values are entered, AA== always appears at the end of the value
CAUSE:
This is expected behaviour. The NULL terminator of the value is also being encoded, so abc + NULL terminator.
FIX:
Use GET-BYTES to extract the exact data required