title: Are there any characters that are not allowed in localStorage?
body: <p>I've been using localStorage to store some binary data in string format, and although the value is definitely set (<code>alert</code>ing it immediately after setting, or even some time after setting, shows the correct value) it is lost when the page next loads.</p>
  
  <p>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.</p>
  
  <p>I added <code>localStorage.testing = 1</code> immediately after setting the binary data. This value is kept, even when the other is lost.</p>
  
  <p>I am absolutely certain there is no code to <code>delete localStorage.myitem</code>.</p>
  
  <p>What could be causing this issue?</p>
  
  <p>If it helps any, here is the data I'm trying to store, in hex:</p>
  
  <pre><code>0x1103c0a0   0xd6cf0305   0xc0a0d6cf   0x0307c0a0   0xd6cf0309   0xc0a0d6cf
  0x030bc0a0   0xd6cf030d   0xc0a0d6cf   0x0311c0a0   0xd6cf0313   0xc0a0d6cf   0x0301
  </code></pre>
  
  <hr>
  
  <p>EDIT: I just tested with <code>localStorage.testvalue = realvalue.replace(/[\x00-\x1f]/g,'');</code> and that successfully saved it. So, I'd like to know where the specification says that control characters may not be used in strings.</p>