0

I am using scribe for oauth. In the oauth response, I receive a list of names (some of which are non-english characters e.g.chinese/japanese). Is scribe able to handle these characters (encode/decode in utf-8 compliant fashion) or is this responsibility of those implementing the api? Has anyone come across the same issue and how did they resolve it (while using scribe). Right now, if I print/log out the response.getBody, it displays characters which do not appear to be properly decoded. It could possibly be an oversight on my end - I am simply seeking some useful suggestions.

My back end systems appear to be utf-8 compliant and able to handle utf-8 characters.

Roman C
  • 49,761
  • 33
  • 66
  • 176
ali haider
  • 19,175
  • 17
  • 80
  • 149
  • russian use encoding cp1251 in windows and koi-8 in unix, so utf-8 not necessary. – Roman C Jan 10 '13 at 17:07
  • spaciba - may I ask if you handled russian characters using scribe (java api for social auth) and if so, did you add decoding on your own or relied on scribe for that? – ali haider Jan 10 '13 at 17:12
  • I resent the fact that the Russian characters encode Unicode, although this is not necessary. Why Latin characters are not encoded in Unicode? – Roman C Jan 10 '13 at 17:18
  • thanks for sharing. I may have been wrong (scribe may be decoding the characters properly - I had an issue with another library) - I will update the post once I proceed further with my testing. – ali haider Jan 10 '13 at 17:53
  • "appearing characters that is not properly decoded" actually decoded by the encoding to the destination that is expect another encoding to show. – Roman C Jan 10 '13 at 18:01

2 Answers2

1

You can use the Response getStream method and parse the contents with whatever encoding you want.

Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
0

I used apache common lang for handling the messages & have not experienced an issue. I would use prepared statements if this information would go to a relational DB. Hope it helps.

ali haider
  • 19,175
  • 17
  • 80
  • 149