Using a very old production workhorse Lucee here to play around with OpenAI API and I bumped - first time in years - to the notorious mojibake character encoding problem.
Posting a totally valid UTF-8 payload to OpenAI API through CFHTTP I get data back that has messed up the non-ASCII characters (mojibake).
The response data I get from OpenAI API using CFHTTP converts “ä” to “ö” and so on. The very basic behaviour when character encoding is somehow totally messed up.
Using getAsBinary=“yes” wont work, as API throws a 400 error if using that. Setting charset=“utf-8” or leaving it out as a CFHTTP attribute wont do any difference. Also, tweaking the headers (applicatoin/json vs adding explicit charset there) doesn’t seem to change the situation.
Posting the exact same payload manually through curl or HTTPie works and doesn’t mess up the encodings.
Any tips? Has this been resolved in same Lucee updates during the past 6 years ( yes… I know, it is an old, old instance).
OS: Linux
Lucee Version: 5.3.2.77