Closed oztek22 closed 6 years ago
Hi @oztek22 ,
How are you trying to store the cookie? (Cookie, CookieService, UnmanagedCookie UnmanagedCookieService ?)
Can you post the snippet here or at plnkr or jsfiddle?
All right.
I'm assuming you are using Cookie or CookieService to work with cookies at your code. If that's the case, we use encodeURIComponent and decodeURIComponent to encode / decode every cookie name and value, so we avoid some problems with special caracters when using cookies. (it doesn't like some caracters like semicolon). When you enconde a string it usually get bigger than the original one, and if you have a lot of special characters, it can get 3 or 4 times bigger (as in the string ";;;;;;;;;;" - 10 characters - which is encoded to "%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B" - 30 characters... or "ÿÿÿÿÿÿÿÿÿÿ" - 10 chars - that encodes to "%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF%C3%BF" - 60 chars).
So... yes. This is the expected behavior. And that's why we delivered the Unmanaged version of both classes - so you can chose which one you want to work. The Unmanaged version does no transformations for you and you must handle the special cases yourself.
I'm trying to store 3 encoded strings of different size. Ideally cookie it should store cookies of size upto 4KB but it is not going above 1.5KB and I'm not seeing any error either.
app.component.ts:109 => size of string app.component.ts:112 => this.cookieService.getAll() is logged.