Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

incompatability with php encoded cookies containing space in value #13

@glensc

Description

@glensc

the problem is that php encodes space into +, and jquery cookie does not decode it accordingly

here's test case showing the problem

<?php
setcookie('b', 'kala mägi+');
?><!doctype html>
<head>
<title>cookie test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="https://github.com/carhartl/jquery-cookie/raw/67fb34f6a866c40d0570265e8fa5911605d92616/jquery.cookie.js"></script>
</head>
<body>
<script type="text/javascript">
document.write("document.cookie: <b>" + document.cookie + '</b><br/>');

document.write("cookie 'c' value: <b>" + $.cookie('c') + '</b><br/>');
$.cookie('c', 'kala maja+');

document.write("cookie 'b' value: <b>" + $.cookie('b') + '</b><br/>');
</script>
</body>
</html>

this results:

  document.cookie: c=kala%20maja%2B; b=kala+m%C3%A4gi%2B
  cookie 'c' value: kala maja+
  cookie 'b' value: kala+mägi+

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions