1

I'm writing a Go package for communicating with a 3rd-party vendor's API. Their documentation states roughly this:

Our API uses the ISO-8859-1 encoding. If you fail to use ISO-8859-1 for encoding special characters, this will result in unexpected errors or malformed strings.

I've been doing research on the subject of charsets and encodings, trying to figure out how to "encode special characters" in ISO-8859-1, but based on what I've found this seems to be a red herring.

From StackOverflow, emphasis mine:

UTF-8 is a multibyte encoding that can represent any Unicode character. ISO 8859-1 is a single-byte encoding that can represent the first 256 Unicode characters. Both encode ASCII exactly the same way.

ISO-8859-1 is a binary encoding format where each possible value of a single byte maps to a specific character. It's certainly within my power to have my HTTP POST body encoded in this way, but not any characters beyond the 256 defined in the spec.

I gather that, to encode a special character (such as the Euro symbol) in ISO-8859-1, it would first need to be escaped in some way.

Is there some kind of standard ISO-8859-1 escaping? Would it suffice to URL-encode any special characters and then encode my POST body in ISO-8859-1?

Matt Mc
  • 8,882
  • 6
  • 53
  • 89
  • 2
    There is no way to "escape" characters in ISO-8859-1 (or any other charset). You can only use characters supported by charset and thats it. – ain Jun 29 '18 at 21:28
  • @ain Thanks. Would care you expand on that and post an answer? Then your input could be upvoted and possibly Accepted. – Matt Mc Jun 29 '18 at 22:22

0 Answers0