Suggestion: Add a "plain" encoding type


#1

I’ve noticed that it is not possible to fetch questions without any encoding whatsoever. This makes developing my application a bit tedious because I have to unescape every question and answer I receive from the API.

I don’t see any reason why it shouldn’t be an option, so I propose a new plain parameter for encode that returns questions in plain text without any encoding.


#2

There’s no “plain” encoding. I’d suggest UTF-8 or something similarly sane.


#3

I think you are mixing something up here. All the encodings provided by OpenTDB are binary-to-text encodings, UTF-8 is a character encoding.

Yes, there is no “plain” encoding, because plain essentially means unencoded. I merely proposed it as an additional option for the encode parameter because OpenTDB already has a default encoding and I don’t want to break backwards compability.

I guess you could also use “none” instead of “plain”, that might be slightly better.


#4

By default, if there isn’t an encoding selected, no encoding will be done to the results of the API. Due to the fact that it’s a JSON API, characters that conflict with the JSON format will be escaped.


#5

Alright, I was wrong. It is indeed not encoded but escaped. But why is the API escaping so many characters that it doesn’t need to?

Why are they all HTML escapes? Instead of escaping quotes (") with a \, it puts ". Single quotes (’) are being escaped using ' even though not escaping them is 100% valid JSON.

Using your API in an environment that can’t interpret these escapes is overly complicated and I am asking you to take another look at the implementation.