While I'm trying to pass a timestamp as param for a post request, on Arabic phones etc., it seems to convert it into a unicode rather than a long. Can anyone explain me any theories behind this.
This is how I'm generating the time stamp string.
String timeStampString = String.format("%d",System.currentTimeMillis()/ 1000L);
But on server I'm getting unicode strings like '\xd9\xa1\xd9\xa4\xd9\xa3\xd9\xa0\xd9\xa4\xd9\xa1\xd9\xa8\xd9
\xa8\xd9\xa2\xd9\xa0'
.
Just use String.valueOf(long)
instead:
String timeStampString = String.valueOf(System.currentTimeMillis() / 1000L);
Unlike String.format
, that will always format using "regular" digits '0' to '9'.
See more on this question at Stackoverflow