Suppose my status is 'Setting my status to <hello>'.

The XML returned by Twitter is :

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id>10179842</id>
  <name>nataraj</name>
  <screen_name>nataraj</screen_name>
  <location>trivandrum</location>
  <description>What to say?</description>
  <profile_image_url>http://static.twitter.com/images/
default_profile_normal.png</profile_image_url>
  <url>http://[email protected]</url>
  <protected>false</protected>
  <followers_count>7</followers_count>
  <profile_background_color>5C8082</profile_background_color>
  <profile_text_color>141212</profile_text_color>
  <profile_link_color>1C00FF</profile_link_color>
  <profile_sidebar_fill_color>E0FF91</profile_sidebar_fill_color>
  <profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
  <friends_count>8</friends_count>
  <created_at>Mon Nov 12 13:12:05 +0000 2007</created_at>
  <favourites_count>1</favourites_count>
  <utc_offset>-36000</utc_offset>
  <time_zone>Hawaii</time_zone>
  <profile_background_image_url>http://static.twitter.com/images/
themes/theme1/bg.gif</profile_background_image_url>
  <profile_background_tile>false</profile_background_tile>
  <following>false</following>
  <notifications>false</notifications>
  <statuses_count>1964</statuses_count>
  <status>
    <created_at>Sat Jan 17 09:51:47 +0000 2009</created_at>
    <id>1125898216</id>
    <text>Setting my status to &amp;lt;hello&amp;gt;</text>
    <source>web</source>
    <truncated>false</truncated>
    <in_reply_to_status_id></in_reply_to_status_id>
    <in_reply_to_user_id></in_reply_to_user_id>
    <favorited>false</favorited>
    <in_reply_to_screen_name></in_reply_to_screen_name>
  </status>
</user>

Note that the status returned is   <text>Setting my status to
&amp;lt;hello&amp;gt;</text>

It should be <text>Setting my status to &lt;hello&gt;</text>

Why twitter is encoding the < and > characters twice? Is there any
specific reason?
It seems to me as a bug in Twitter API.

Regards
Nattu


On Jan 16, 11:28 pm, "Alex Payne" <[email protected]> wrote:
> Sorry, but that's the intended behavior. It makes it difficult for
> people to inject HTML or scripts into tweets.
>
>
>
> On Fri, Jan 16, 2009 at 07:43, twonvo.com <[email protected]> wrote:
>
> > i have a similar problem... when submitting from my tool the user
> > cannot use &!
>
> > any ideas? - tried converting to &amp; with no luck
>
> > On Jan 16, 2:52 pm, nattu <[email protected]> wrote:
> >> If the status message for a user contains the characters '<' or '>',
> >> while
> >> fetching through the API, the returned status contains the double html
> >> encoded form of < and >, i.e., '&amp;&lt;' and '&amp;&gt;'. This is
> >> causing
> >> issues when used in our application.
>
> >>http://twitter.com/statuses/update.xml
> >> We are requesting the status update for which the new status is
> >> returned.
>
> --
> Alex Payne - API Lead, Twitter, Inc.http://twitter.com/al3x

Reply via email to