We have web services to be consumed by an iphone app based on codeigniter, parameters are passed through headers. Everything was working fine until there was a euro(€) symbol in the parameters value. Whenever the parameter sent from the iphone has an euro symbol it gets truncated. Any ideas where i am doing wrong or how we should be doing this?
Asked
Active
Viewed 417 times
2
-
1The `€` gets encoded to `€`. Maybe this breaks the header - check your app logic. – Silviu G Oct 15 '12 at 11:27
-
1where does the € get encoded? i am really not sure how and where to debug this. Do you think its an issue in the iPhone app or in the web-service. i am unable to determine whether the symbol is received at the server or not. – Asif Balgar Oct 15 '12 at 11:50
-
1How does the iPhone app encode the euro symbol into the headers? Although HTTP header specification only permits ASCII characters, PHP under Apache is very permissive, so the problem is likely on the iOS side. – Joni Oct 15 '12 at 13:04
1 Answers
3
You cannot send non-ASCII characters in HTTP headers, as per the RFC (RFC 2616, if you're interested). What happens when you do is, as far as I know, undefined - it appears your server throws away the rest of the header.
You need to URL-encode the value of your header before sending it (replacing the special characters with %XX strings, as you can often see in address bars in browsers).
To do it properly on the IPhone, see this post. On the PHP end, urldecode()
will allow you to retrieve the original header.

Community
- 1
- 1

Jakub Wasilewski
- 2,916
- 22
- 27
-
1If you do this incorrectly, the result will be `€`. It will be `%26euro%3b` if encoded first to HTML, then to an HTTP URL parameter. – tadman Oct 15 '12 at 14:27
-
thanks a lot. url encoding the parameter values fixed my problems. thanks a lot. – Asif Balgar Oct 17 '12 at 13:49