Announcement Announcement Module
Collapse
No announcement yet.
Twitter Update Problem with Character Encoding Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Twitter Update Problem with Character Encoding

    Hi,

    i must admit that i have no in-depth knowledge of the spring-social project and just use it as a module in a big spring web project.

    I found that when trying to update the status with special characters in UTF-8 (in particular we use the german umlaute and the sz ) i get an exception that leads me in a deceptive direction:

    Code:
    Exception in thread "main" org.springframework.social.AccountNotConnectedException: Could not authenticate with OAuth.
    	at org.springframework.social.twitter.TwitterResponseStatusCodeTranslator.translate(TwitterResponseStatusCodeTranslator.java:76)
    	at org.springframework.social.twitter.TwitterTemplate.handleResponseErrors(TwitterTemplate.java:322)
    	at org.springframework.social.twitter.TwitterTemplate.updateStatus(TwitterTemplate.java:139)
    	at org.springframework.social.twitter.TwitterTemplate.updateStatus(TwitterTemplate.java:131)
    	at de.******.scheduled.TwitterJob.main(TwitterJob.java:80)
    Is this a known issue? Does everybody except me know that twitter does not accept UTF-8? Is there a setter of the TwitterTemplate class that i missed?

    I know that the question will come so i post the code but there is nothing special about it:

    Code:
    public class TwitterJob {
    	
    	public static final String API_KEY = "***";
    	public static final String API_SECRET = "***";
    	public static final String ACCESS_TOKEN = "***";
    	public static final String ACCESS_TOKEN_SECRET = "***";
    
    	public static void main(String[] args) {
    		TwitterTemplate tt = new TwitterTemplate(API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
    		tt.updateStatus("test normal"); // works
    		tt.updateStatus("test umlaute "); // EXCEPTION !!!
    	}
    }
    Thanks in advance
    Lori
    Last edited by Lori; Nov 23rd, 2011, 07:30 AM.
Working...
X