# Message encoding

> Messages containing special characters should be properly encoded before transmission, using Base64 for byte data and URL encoding for HTTPS URLs to ensure accuracy and avoid ambiguity.

To prevent errors or ambiguity caused by special characters enclosed in a message, encode the message properly before transmitting it.

| **Encoding scenarios** | **Encoding method** |
| --- | --- |
| For the byte data, such as the signature and the encrypted content, encode the data with the `base64` algorithm before transmitting. | `base64` |
| For the HTTPS URL data, perform URL encoding first via the `urlencode` algorithm before transmitting. For example: - Original URL: `https://www.merchant.com/authorizationResult` - Encoded URL: `https%3A%2F%2Fwww.merchant.com%2FauthorizationResult` | `urlencode` |