User's Location is more than 30 characters


Hitting the api /1.1/statuses/show/552958864555921408.json

Returns the value of the user->location field as "[26.12.14] Official fansbase @alysyarief @aliando26 @prillybie [] Always support you and love you so much []\nFllwd by:@ullyjulita1". 

The above is much longer than 30 Characters. What is the expected length?


Thanks for the inquiry, here!

We officially support 30 characters, but may return longer fields for backward compatibility.

For the purposes of user input, it is safe to limit to 30. For displaying data coming back from twitter, I would design your app/site for something responsive that can show more/multiple lines.



Unfortunately that user has obviously populated the Location field with something that would be much better in their description! As @rchoi says, the values may be longer than 30 characters for legacy reasons. You probably don’t want to hard code the length of the strings, although you “should” be safe to truncate the value to a maximum of 30 characters in the case of that particular field… there should not be too many edge cases of this kind with unusual values like that, I would hope.