JS decode/encode revisited