Forum Discussion
Hey ravienu,
Im a bit confused and also im a bit too literal sometimes, so youll have to bear with me.
Unicode is a character set
UTF-8 is character encoding
So! Theyre related but are completely different.
Within ReadyAPI you have some system properties (available via the Help menu option) and within here youll see some encoding parameters that are global....ive just had a look at mine and it says cp1252 for sun.encoding and file.encoding parms.
You can override this explicitly and it sounds like youve done this, specifying UTF-8.
To answer your question, yes....its completely reasonable to be explicit with your encoding. You dont mention what payloads youre submitting, but xml includes the char encoding and xml version in the xml declaration at the top of the xml instance, although the requirement for this has relaxed. Regarding json, previous earlier versions of json didnt require encoding, but more recent versions of software that support parsing json uses UTF-8 as the encode.
Whether your api needs the explicit encoding is entirely up to how its been coded and the requirements of the system.
Hhmm...not sure if i actually helped at all.....🤷♂️😉
Oh. One more thing. If no explicit encoding is set for json then its just plain text rules (no encoding) and if i can remember correctly i think thats iso-8859......i think.....
Cheers,
Rich
- giovanni_favara3 years agoContributor
Hello ravienu ,
what richie wrote is correct. I'd like to add a different perspective to richie's answer.Each system or systems behind an API is different and in part follows an individual configuration or implementation, complying with some standards or not.
A good API also has good documentation. If this documentation, preferably with OpenAPI, defines that only UTF-8 is accepted and this specification is mandatory, then the character encoding must also be specified according to the documentation. It is not defined in HTTP that if nothing is specified then the message must be interpreted as UTF-8.
It is good practice, if the message is not encoded in ASCII, to supply the character encoding. Only with ASCII characters can one assume that the characters will definitely be interpreted correctly - but in practice there is no guarantee of this. Always remember, no system or API is always correctly configured or implemented. Always take the safe route and always specify the character encoding.
Cheers,
Giovanni
Related Content
- 4 years ago
- 11 years ago
- 5 years ago
Recent Discussions
- 5 days ago
- 9 days ago