title: Encoding and decoding with php and javascript and data attributes validation
body: <p><br>
  Im using data-attributes for sending data from html to javascript
  <br>
  The data attributes come from mysql data so it might have a space in it, so<br>
  i get validation errors as it says no space are allowed inside attributes<br></p>
  
  <p>So the solution i thought if is to encode the value in php so it has no spaces <br>
  and then decode it in javascript once it has been passed on to javascript. Is there a premade function for this?
  A failsafe way will be awesome :)</p>
  
  <p>Also is there a way to store values in data-attributes with having space in it and getting it to validate?</p>