I am not getting the correct order of the message if I set the language to non-english. The non-english words are coming ok, but not in correct order. Please help and suggest if I have to additional to get the proper order.
The code snippet is as below:
send_ios_msg(Token,Badge1,Type,Msg,ENUM,Groupid,Groupname,Sender_list_without_resource,Content_list,Socket) ->
Msg_final =list_to_binary(Msg),
Msg_final_binarytolist = binary_to_list(Msg_final),
%%Preparing Payload
Payload = mochijson:encode({struct,[{"aps", {struct, [{"alert", Msg_final},{"content-available",Badge1}]}}, {"acme1", Type},{"acme2", Msg}, {"acme3", ENUM},{"acme4", Groupid}, {"acme5", Groupname},{"acme6", Sender_list_without_resource}, {"acme7", Content_list}]}),
%%Converting Payload to binary
BPayload = erlang:list_to_binary(Payload),
%%Fetching length of payload
PayloadLen = erlang:byte_size(BPayload),
%%Converting hexadecimal token to binary
BToken = hexstr_to_bin(Token),
%%Fetching length of token
BTokenLength = erlang:byte_size(BToken),
SomeID= 1,
%%time stamp
{MSeconds,Seconds,_} = erlang:now(),
Expiry = MSeconds * 1000000 + Seconds + 3600*1,
%%Constructing APNS packet
Packet = <<1:8, SomeID:32/big, Expiry:32/big, BTokenLength:16/big, BToken/binary, PayloadLen:16/big, BPayload/binary>>,
%Sending data over SSL
ssl:send(Socket, Packet).