Loopj在通过请求发送特殊字符之前弄乱了它们 [英] Loopj messing special characters before sending them through a request

查看:153
本文介绍了Loopj在通过请求发送特殊字符之前弄乱了它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过http请求发送特殊字符,现在我将Loopj用作我的http客户端.问题是,当我尝试发送特殊字符(即áéíóú")时,请求以字符·ÈÌÛ˙"发出,这在服务器端引起了一些问题.

I'm trying to send special characters through an http request, now I'm using Loopj as my http client. The problem is that when I try to send special characters i.e. "áéíóú" the request goes out with the characters "·ÈÌÛ˙", this is causing some issues on the server sider.

我遍历了Loopj代码,找不到与重新编码字符串有关的任何内容或类似的内容.在最坏的情况下,它似乎会以实际上支持该字符的UTF-8进行编码.

I've gone through the Loopj code and couldn't find anything relative to recoding my string or anything like it. In the worst case it seems like it would be encoded in UTF-8 which actually supports this characters.

希望任何人都可以提供帮助.

Hope anyone can help.

最好的问候.

推荐答案

我猜你是说AsyncHttpClient库,对吗?

I am guessing you mean AsyncHttpClient library, correct?

AHC默认将所有I/O编码为UTF-8.由于缺乏源代码,我将指导您进行以下调查:

AHC defaults to encoding all I/O in UTF-8. Due to the lack of source code, I would point you to investigate the following:

  1. 输入的编码是什么?确保它位于UTF-8中.
  2. 您是否通过可能会更改其编码的过滤器/功能运行输入?确保过滤器/功能也产生UTF-8.
  3. 在检查后端实际收到的内容之前,将您的客户端更改为提交至 http://httpbin.org/post ,然后检查结果.
  4. 如果您在httpbin中收到正确提交,而在后端中收到错误提交,则问题是在AHC中不是,但是在您的后端.
  5. 如果您同时在httpbin和后端收到错误提交,则发送的数据最初是错误错误的编码.
  1. What is the encoding of the input? Make sure it's in UTF-8.
  2. Are you running the input through a filter/function that might change its encoding? Make sure that the filter/function produces UTF-8 also.
  3. Prior to checking what your backend actually receives, change your client to submit to http://httpbin.org/post and then check the result.
  4. If you receive correct submission in httpbin, and bad submission in your backend, the problem is NOT in AHC but in your backend.
  5. If you receive bad submissions in both httpbin and the backend, then the data being sent was originally bad or in a wrong encoding.

我希望这可以帮助您快速找到问题所在.

I hope this helps you find the problem quickly.

这篇关于Loopj在通过请求发送特殊字符之前弄乱了它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆