[ Utility ] Epicor SaveGridLayout Chinese Characters

@josecgomez and I were wondering why Kinetic Grid Layouts Speak Chinese.


Turns out it is just UTF-16 compressed with a javascript library called zlib. If you want to view the contents of the layout and possibly make some changes and then invoke the Ice.BO.KineticErpSvc/ SaveGridLayout method yourself. We slapped together a quick jsfiddle.

It will also output the JSON to the console for easier reading.

(SAFE HARBOR, I quickly made this without having any coffee in me).

Fiddle Link

Additional Details about UTF-16

  • localStorage can only contain JavaScript strings. Strings in JavaScript are stored internally in UTF-16, meaning every character weight 16 bits. I modified the implementation to work with a 16bit-wide token space.
  • compressToUTF16 produces “valid” UTF-16 strings in the sense that all browsers can store them safely. So they can be stored in localStorage on all browsers tested (IE9-10, Firefox, Android, Chrome, Safari). Can be decompressed with decompressFromUTF16. This works by using only 15bits of storage per character. The strings produced are therefore 6.66% bigger than those produced by compress