[Resolved] Network request and post https with unicode data on Android

I’t really urgent.
I am trying to make a post request to https service from my game using this code:

postData = “something with unicode inside ???”

local params = {}
params.body = postData

network.request(“https://someservice”, “POST”, networkListener, params)

on iphone it works fine.

on Android i get in the server question marks (each unicode character becomes a question mark).
I need to know how to get over this issue ASAP…really urgent

Thanks
[import]uid: 134964 topic_id: 24700 reply_id: 324700[/import]

You should URL encode your post data… See:

http://stackoverflow.com/questions/6603928/should-i-url-encode-post-data

local function urlencode(str)  
 if (str) then  
 str = string.gsub (str, "\n", "\r\n")  
 str = string.gsub (str, "([^%w])",  
 function (c) return string.format ("%%%02X", string.byte(c)) end)  
 str = string.gsub (str, " ", "+")  
 end  
 return str  
end  
  
function urldecode(str)  
 str = string.gsub (str, "+", " ")  
 str = string.gsub (str, "%%(%x%x)",  
 function(h) return string.char(tonumber(h,16)) end)  
 str = string.gsub (str, "\r\n", "\n")  
 return str  
end  
  
postData = urlencode("something with unicode inside ???")  

[import]uid: 19626 topic_id: 24700 reply_id: 100111[/import]

Thanks! Worked! (why is it needed on android and not on iphone??). [import]uid: 134964 topic_id: 24700 reply_id: 100120[/import]

Dunno for sure, but a couple of possiblities include character set differences between the two OS’s, Apple doing the encode for you… Ansca doing on iOS but not Android? [import]uid: 19626 topic_id: 24700 reply_id: 100125[/import]