Support node-webkit and fixed bug

In node-webkit, both window and exports exist, but exports should be used instead of window.

Also fixed two escaping bugs:
1. `^` is not escaped so `unpack( pack( { x: '^' } ) )` gives error
2. `%` is not escaped so `unpack( pack( { x: '%7C' } ) )` gives { x : '|' }