Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For encoding cookie values, you need to be careful. See this <a href="https://stackoverflow.com/questions/1693174/jboss-5-truncates-trailing-of-a-base64-cookie-string/1696756#1696756">older answer</a>:</p> <blockquote> <p>With Version 0 cookies, values should not contain white space, brackets, parentheses, <strong>equals signs</strong>, commas, double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same way on all browsers.</p> </blockquote> <p>Base64 encoding can generate <code>=</code> symbols for certain inputs, and this technically is not permitted in cookies (version 0 cookies, anyway, which are the most widely supported). In practice, I suspect the <code>=</code> will actually work fine, but maybe not.</p> <p>I would suggest that to be absolutely sure that your encoded binary is cookie-compatible, then basic hex encoding is safest (e.g. <a href="http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Hex.html#encode(byte[])" rel="nofollow noreferrer">in java</a>).</p> <p><strong>edit:</strong> As @Paul helpfully pointed out, there is a <a href="http://en.wikipedia.org/wiki/Base64#URL%5Fapplications" rel="nofollow noreferrer">modified version of Base 64</a> that is "URL safe" (and, I assume, "cookie safe"). Using a modified version of a standard algorithm rather dilutes its charm, mind you.</p> <p><strong>edit</strong>: @shoosh pointed out that the <code>=</code> is only used to denote the end of the base64 string, so you could trim the <code>=</code>, set the cookie, then reattach the <code>=</code> again when you need to decode it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload