I am working on setting a cookie in a browser, and I'd like to base64 encode a string of data as the value. The call to base 643 encode is trivial
public static String encodeToBase64(String input) {
return new String(Base64.encodeBase64(input.getBytes()));
}
But I'm wondering, can I include a + or an = in a cookie? My cookie generation device looks something like this
String parameterData = Base64Utils.encodeToBase64(JsonUtils.objectToJson(parameters));
String expires = epochMillisToExpirationString(getExpiration());
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("data=");
stringBuilder.append(parameterData);
Has anyone seen this break down? Is there any documentation on Cookie standards that discuss this sort of issue?