Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / inconsistencies on facebook between PC and android with httpencode

Author
Message
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 22nd Jul 2014 15:03
Hello !
I use httpencode in postdata to post a message on facebook in my app but I have a problem. I want the facebook message to write this :

Record du défi mondial battu !

The message is right when I use the PC version of my game. But when I use the android version, I get this instead :

Record du d馩 mondialࢡttu !

Which is not cool. Do you know how to address it ?
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Jul 2014 15:57
where the message comes from ? editbox or const string?

httpencode replace only chars with special syntax
so in example a space is %20 or & = are already used in url/link
so if your parameter contains this, this appear as %..

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 22nd Jul 2014 16:14 Edited at: 22nd Jul 2014 16:16
The message is a constant string. Here's the relevant extract from my code :



In the end, the message is successfully posted when I send it from my PC. But when using Android, every special character is messed up.
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 22nd Jul 2014 16:35 Edited at: 22nd Jul 2014 16:36
Sorry for the double post but I've got new informations. I copied the url that ended up in the browser on PC and on Android. Here are the results. The message before httpencode is :

Jouez à Mac's Run gratuitement sur Android !

Here's the PC result after httpencode :



And here's the Android result :

Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Jul 2014 17:40 Edited at: 22nd Jul 2014 17:48
hmm, + = %20 is ok , the other are different, i agree.
the ending its odd with 3 chars.
i would expect space and than %21

did u use in ide options editor/other settings encoding windows 1252?

pc


AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265

Attachments

Login to view attachments
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 22nd Jul 2014 18:44 Edited at: 22nd Jul 2014 18:46
I didn't touch the ide options. I'm too scared to screw things up.

I just checked in "settings -> editor -> other settings" (tab) and the "encoding" section reads "windows-1252"

I'm still with 1.021 because I use modified template files. I don't know if it's important but on android the url changed to "m.facebook" in the browser. I don't know if it modified anything else in the process because the switch is very quick.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Jul 2014 20:23
Since you have the correct HTTP encoding from the PC result you could make that your constant string and then not have to run it through HTTPEncode.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 22nd Jul 2014 21:14 Edited at: 22nd Jul 2014 21:20
Yeah, that's what I intend to do but I was looking for another solution because I have around 50 of such constant strings. Many of them are mixed with user generated numbers (which should not be a problem to encode) to make the message so it's less than ideal of a solution.

Thanks for your help.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd Jul 2014 22:09
ick 50? I'd write a parser that ran each string through HTTPEncode and saved them all to a file where I could grab them later. And yeah, just add in the variable text for the numbers. I wonder why there is a difference between Windows and Android for this. You should probably bring it to Paul's attention to see if it can be improved for V2.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 22nd Jul 2014 22:54
I had a quick look at this and the problem isn't in HTTPEncode but in OpenBrowser. Windows is handling the string as an Extended Ascii string whilst Android is handling it as UTF-8, Facebook is then doing some additional URL encoding but the damage is done in the transition from Ascii to UTF-8. The string is passed to the device browser so I have little control over how the string is interpreted, but setting the IDE to UTF-8 might fix it for Android, I'd also be interested to see if the PC browser detects that the string is now proper UTF-8 and still handles it correctly. Although you won't be able to print UTF-8 strings to the screen correctly with AppGameKit print and text commands.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Jul 2014 23:20 Edited at: 22nd Jul 2014 23:21
i am confused, why is openbrowser is used and not
the fb commands first?

btw, notepad can also save in utf8.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 23rd Jul 2014 01:52
I don't use FB commands because I had a lot of problems with them (see here : http://forum.thegamecreators.com/?m=forum_view&t=211178&b=41 ).

If I read Paul correctly, putting the IDE in UTF8 would fix the issue with the browser but then the game wouldn't draw text commands with special characters properly. That is not an option.

I'll try to encode some strings tomorrow and see how it goes. Maybe the message will survive the android utf8 conversion this time. I'll report back with my results.
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 23rd Jul 2014 12:27 Edited at: 23rd Jul 2014 12:30
I encoded the strings directly and it worked. To encode faster, I went to this site :

http://www.url-encode-decode.com/

... And put UTF-8 in the drop-down list. Then I entered the strings I needed in the left box and pressed encode. All I had left to do was to copy the result from the right box and paste them in AGK... 50 times.

Since Paul has no grip on how android handles the url, maybe he could implement a way to make the process less painful from the IDE. For instance, you would select the text you need encoded, right click and then select "encode as url" or something. Just my 5 cents.

Login to post a reply

Server time is: 2024-03-28 20:38:53
Your offset time is: 2024-03-28 20:38:53