Response format
JSON responses contain code (integer, the HTTP status), msg (string), and data (the result). On a 4xx or 5xx error, data is null and msg describes the problem. Encoding and Chinese text endpoints accept form fields.
{"code":400,"msg":"请输入二维码内容","data":null}
Encoding conversions
HEX
POST/api/hex/encodeText → hex
POST/api/hex/decodeHex → text
Request parameters
| Conversion | Parameter | Required | Type | Description |
| Text → hex | str | No | string | Text to encode. Omitting it or sending an empty string returns empty strings. |
| Hex → text | hex | Yes | string | Hex bytes, two digits per byte. Spaces, tabs and line breaks are ignored. At least one byte is required. |
Success response
| Conversion | Parameter | Type | Description |
| Text → hex | data.str | string | Original input text. |
| Text → hex | data.hex | string | Lowercase hexadecimal representation of the UTF-8 input bytes. |
| Hex → text | data.str | string | Text decoded from the hexadecimal bytes. |
| Hex → text | data.hex | string | Input hex string with spaces, tabs and line breaks removed. |
Example
curl -X POST 'https://zxso.net/api/hex/encode' --data-urlencode 'str=AB'
{"code":200,"msg":"success","data":{"str":"AB","hex":"4142"}}
curl -X POST 'https://zxso.net/api/hex/decode' --data-urlencode 'hex=4142'
{"code":200,"msg":"success","data":{"str":"AB","hex":"4142"}}
Unicode
POST/api/unicode/encodeText → Unicode
POST/api/unicode/decodeUnicode → text
Request parameters
| Conversion | Parameter | Required | Type | Description |
| Text → Unicode | text | Yes | string | Text to escape. Only characters from U+4E01 through U+9FA4 are escaped. Other characters pass through. |
| Unicode → text | text | Yes | string | Text containing a backslash, u and four hex digits, e.g. \u98ce. |
Success response
| Conversion | Parameter | Type | Description |
| Text → Unicode | data.text | string | Text after escaping characters, e.g. 风 becomes \u98ce. |
| Unicode → text | data.text | string | Text with Unicode escape sequences decoded. |
Example
curl -X POST 'https://zxso.net/api/unicode/encode' --data-urlencode 'text=风'
{"code":200,"msg":"success","data":{"text":"\\u98ce"}}
curl -X POST 'https://zxso.net/api/unicode/decode' --data-urlencode 'text=\u98ce'
{"code":200,"msg":"success","data":{"text":"风"}}
Punycode
POST/api/punycode/encodeDomain → Punycode
POST/api/punycode/decodePunycode → domain
Request parameters
| Conversion | Parameter | Required | Type | Description |
| Domain → Punycode | domain | Yes | string | Domain name to encode, e.g. 例子.cn. |
| Punycode → domain | domain | Yes | string | ASCII domain name to decode, e.g. xn--fsqu00a.cn. |
Success response
| Conversion | Parameter | Type | Description |
| Domain → Punycode | data.domain | string | Encoded ASCII domain name, e.g. xn--fsqu00a.cn. |
| Punycode → domain | data.domain | string | Decoded Unicode domain name, e.g. 例子.cn. |
Example
curl -X POST 'https://zxso.net/api/punycode/encode' --data-urlencode 'domain=例子.cn'
{"code":200,"msg":"success","data":{"domain":"xn--fsqu00a.cn"}}
curl -X POST 'https://zxso.net/api/punycode/decode' --data-urlencode 'domain=xn--fsqu00a.cn'
{"code":200,"msg":"success","data":{"domain":"例子.cn"}}