douxuzui4590 2011-12-09 12:01
浏览 167

REST请求中的特殊字符

I am developing an API using CodeIgniter, and Phils RESTserver. I am trying to send a POST request containing special characters, but the string is not added to the database.

CodeIgniter also says that lastname is required (that it is not present in the string). Why?

I am using this format:

application/x-www-form-urlencoded

This is my string:

firstname=Andrew&lastname=Åsberger

It is very important that I can use special characters for internationalization.

Thankful for all input!

  • 写回答

5条回答 默认 最新

  • dongleiqiao4906 2011-12-09 12:18
    关注

    You should URI-encode each name and value. Hopefully the client and server code will both agree that UTF-8 should be used for encoding the octets of characters outside of the US-ASCII range (since earlier URI-encoding standards weren't specific and there is legacy code out there that tries other encodings), so your example becomes:

    firstname=Andrew&lastname=%C3%85sberger

    Just like it would in the query portion of a URI used with a GET.

    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题