• Resolved Clipperer

    (@clipperer)


    Hi,

    I’m not really sure if it is a plugin specific issue, but here it is:
    When I send my requests via ajax I use encodeURIComponent() for their encoding. However, when the string is used in the plugin all the special chars like @ and | are stripped off it with no other data loss on the string. Of course the API reports that the given parameters are invalid.

    PHP version running on server is +5.3.29

    Thanks in advance.

    https://wordpress.org/plugins/json-api-user/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ali Qureshi

    (@parorrey)

    Try to print $_REQUEST array and see which data is being sent and then stripped.

    Thread Starter Clipperer

    (@clipperer)

    Thanks for the speedy response, Ali, I’ll keep in mind your advice next time I’m debugging, luckily I’ve managed to deal with the issue.
    For anyone that has trouble getting special chars through the WP JSON API (not your plugin specifically) this might be helpful:

    I’ve tried sending the data in numerous ways, however what works for sure is sending an ajax ‘post’ request with your query data formatted like that:

    query = encodeURIComponent(parameter) + ‘=’ + encodeURIComponent(value);
    (add ‘&’ at the end if you are sending more than one variables, as usually is the case).
    Any other strings, url concats, sending objects, etc. wouldn’t work for me. The type of the request doesn’t matter (jquery post and ajax, angular $http work for sure).

    Again, thanks for the speedy response. You can check the thread as solved.

    Plugin Author Ali Qureshi

    (@parorrey)

    Thanks for detailed response.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query doesn't decode special chars’ is closed to new replies.