Jump to content

Issue with llHTTPRequest() leading to the wrong encoding


Kadath Blackheart
 Share

Recommended Posts

Hey all, I've scratched my head all day trying to figure this one out.

 

I send this request (simplified):

gKey = llHTTPRequest("URL", [HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded;charset=utf-8"], "");
http_response(key request_id, integer status, list metadata, string text) {
        if (request_id == gKey) {
            if (status == 200) {
            llOwnerSay(text);
			}
		}
}

The URL takes me to an API that returns a single string of text

Except... the encoding's all wrong, despite specifying charset=utf-8. I get this response:

ã¢ããªã±ã¼ã·ã§ã³

Instead of:

アプリケーション

This only happens when I'm using the script to access the API. The in-world browser, my own browser, everything else works fine.

Using https://mothereff.in/utf-8 to decode the bad output does result in アプリケーション. ( if you copy/paste it from here anyway https://pastebin.com/yWWL779Q )

 

Is there any way I could force the API to output its result in utf-8 if HTTP_MIMETYPE doesn't help?

Edited by Kadath Blackheart
Link to comment
Share on other sites

Unfortunately the API asks specifically for "application/x-www-form-urlencoded", but I did try other MIME types like plaintext and html, and they don't change the output :(

The output is a raw "application/json" page without any charsets specified, which doesn't trip up most applications/browsers, but llHTTPRequest can't quite fill the blanks.

 

To make things even better, the API doesn't recognize "Accept-encoding: " headers so I'm left having to chat with their support team to see if they can tweak their app for me, which... is a long shot.

 

The only thing I might be able to do on my end, is somehow figure out a way to decode the gibberish with a script

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...