Written by

Question Paul Riker · Jun 29, 2016

CSP Illegal Value error

I've created a CSP page to take in a base64 value from a <textarea> and decode it. When I run it I get the error . Any ideas?

Error: <ILLEGAL VALUE>zOnPageBODY+28^csp.decode.1

ErrorNo: 5002

Here is my code

<form method="post" action="">
<table>
<tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr>
<tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h2>Result</h2></td></tr>
<tr><td>
<script language=Cache runat=server>
Set tString = $Get(%request.Data("submitstring",1))
Set tAction = $Get(%request.Data("decodeoption",1))
If tAction = "Decode"
{
Set tOutput = $SYSTEM.Encryption.Base64Decode(tString)
}
Else
{
Set tOutput = $SYSTEM.Encryption.Base64Encode(tString)
}
Write tOutput
</script>
</td></tr>
</table>
</form>

Comments

Eduard Lebedyuk · Jun 29, 2016

Cache version?

Your code runs without errors on 2016.1.

0
Eduard Lebedyuk  Jun 29, 2016 to Paul Riker

What value are you trying to decode?

0
Eduard Lebedyuk  Jun 29, 2016 to Paul Riker

Your input is too long, so  it's not a string but rather %CSP.CharacterStream.

0
Eduard Lebedyuk  Jun 29, 2016 to Paul Riker

I mean can you post it (or any other base64 string giving you an error) here?

I seem unable to reproduce the error.

0
Paul Riker  Jun 29, 2016 to Eduard Lebedyuk

It's a CCDA in base64

0
Paul Riker  Jun 29, 2016 to Eduard Lebedyuk

2014.1.4 (Build 803_2U) 

0
Alexander Koblov · Jun 29, 2016

Do you just run the page or put some value in textarea?

0
Paul Riker  Jun 29, 2016 to Alexander Koblov

If I put a short value like "test" in there it encodes, then I copy the base64 and it decodes. If I copy a real base64 CCD it errrors out. Is it a character limitation?

0
Eduard Lebedyuk · Jun 29, 2016

Based on Alexanders comment, I think this should work.

<form method="post" action="">
<table>
<tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr>
<tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h2>Result</h2></td></tr>
<tr><td>

<script language=Cache runat=server>
Set tString = $Get(%request.Data("submitstring",1))
Set tAction = $Get(%request.Data("decodeoption",1))
If tAction = "Decode" {
    Set tString = $SYSTEM.Encryption.Base64Decode(tString)
    Set tOutput = $ZCONVERT(tString,"I","UTF8")
} Else {
    Set tString = $ZCONVERT(tString,"O","UTF8")
    Set tOutput = $SYSTEM.Encryption.Base64Encode(tString)
}
Write tOutput
</script>
</td></tr>
</table>
</form>

I added  UTF8 conversion:

Set tOutput = $ZCONVERT(tString,"I","UTF8")

and

 Set tString = $ZCONVERT(tString,"O","UTF8")
0
Paul Riker  Jun 29, 2016 to Eduard Lebedyuk

Similar error.

A run-time error occurred while executing the page

  • Error: <ILLEGAL VALUE>zOnPageHEAD+26^csp.decode.1
    ErrorNo: 5002
    CSP Page: /csp/ensemble/decode.csp
    Namespace: ENSEMBLE
    Class: csp.decode
    Routine: csp.decode.1
    Location: zOnPageHEAD+26
    Line: Set tString = $SYSTEM.Encryption.Base64Decode(tString)

  •  

0