Encode query and appearance code to Base64.