Why do foreign characters like æøå result in 400?


#1

Hi

I have a small but very important issue.

When I tweet from my form using Danish characters like æøå it results in a bad request.

I have tried to put header(“Content-Type:text/html; charset=UTF-8”); in my scripts, but without luck.

& a e l i g ; results in: & a e l i g ; in the statusupdates where I expect æ (edit: added space in this example since the output was “æ results in æ”.) :o)

Can anyone please help me?

Regards
Steffen


#2

How are you sending this data to the API? Typically you wouldn’t just be using a form. Are you properly percent-encoding the UTF-8 characters once you’ve encoded them? We don’t accept text/html as a Content-Type in the API.


#3

Hi
$tweet_text = ‘ø’;
$connection->request(‘POST’,
$connection->url(‘1/statuses/update’),
array(‘status’ => urlencode($tweet_text)));

output:
%F8