I've been using localStorage to store some binary data in string format, and although the value is definitely set (alert
ing it immediately after setting, or even some time after setting, shows the correct value) it is lost when the page next loads.
At first I figured it might be because the data contained null bytes, so I redesigned the compressor so that it would never output them. However, this made no difference as the value is still lost.
I added localStorage.testing = 1
immediately after setting the binary data. This value is kept, even when the other is lost.
I am absolutely certain there is no code to delete localStorage.myitem
.
What could be causing this issue?
If it helps any, here is the data I'm trying to store, in hex:
0x1103c0a0 0xd6cf0305 0xc0a0d6cf 0x0307c0a0 0xd6cf0309 0xc0a0d6cf
0x030bc0a0 0xd6cf030d 0xc0a0d6cf 0x0311c0a0 0xd6cf0313 0xc0a0d6cf 0x0301
EDIT: I just tested with localStorage.testvalue = realvalue.replace(/[\x00-\x1f]/g,'');
and that successfully saved it. So, I'd like to know where the specification says that control characters may not be used in strings.