APE inlinepush & UTF-8

50 views
Skip to first unread message

pacrook

unread,
May 25, 2012, 7:29:41 PM5/25/12
to APE Project
Using the APE server inlinepush, if I try and push a string containing
an accented character I get BAD_JSON back from the server, for
example:

http://ape.server:6969/?[{"cmd":"inlinepush","params":{"raw":"postmsg","data":{"dots":[{"name":"Café"}]},"password":"testpasswd","channel":"testchannel"}}]

[{"time":"1337987563","raw":"ERR","data":
{"code":"005","value":"BAD_JSON"}}]

change that to:

http://ape.server:6969/??[{"cmd":"inlinepush","params":{"raw":"postmsg","data":{"dots":[{"name":"Cafe"}]},"password":"testpasswd","channel":"testchannel"}}]

[{"time":"1337987858","raw":"pushed","data":{"value":"ok"}}]

and all is okay.

So the accented é in Café seems to be a problem even though it gets
encoded as Caf%C3%A9% by the browser before being pushed.

I've seen the discussion is this group "Does APE supports UNICODE?"
from Dec 2011 but wasn't clear from the description if this it the
same issue.

I downloaded and compiled the APE server from the GIT repository on
Fedeora 15 (Linux).

Louis Charette

unread,
May 25, 2012, 10:44:46 PM5/25/12
to ape-p...@googlegroups.com
You should try encoding the string php side and decoding in the client javascript with something like "decodeURIComponent". I'm not sure exactly which encoding function works best. I never had "BAD_JSON" problem but encoding problem yes. While not using inlinepush, "encodeURIComponent" and "decodeURIComponent" seems to work best for me.

- Louis
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to ape-p...@googlegroups.com
> To unsubscribe from this group, send email to
> ape-project...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/

Reply all
Reply to author
Forward
0 new messages