Alex Rivera | Logout

Special characters in REST request

Asked 2011-12-09T12:01:04.697
8

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!

Edit
Report

1 Answer

6

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.

answered 2011-12-09T12:18:50.877

Your Answer