UTF-8 plugins.http.getPoster .doPost Twitter API

I’m using the plugins.http.getPoster and trying to post Japanese text to the Twitter API, the result that is passed changes Japanese text to ??. Is this a problem with the plugin or with Twitter API? Twitter works fine with Japanese text otherwise like working directly on the site. English and everyting else works fine with Servoy and the Twitter API.

Here is my condensed sample code im using:

var poster = plugins.http.getPoster(‘https://’ + ‘twitter.com/statuses/update.json’);
var vAddParamone = poster.addParameter(‘status’,vStatusUpdateTxt);
var vAddParamtwo = poster.addParameter(‘source’,globals.twitter_source);
var httpCode = poster.doPost(globals.twitter_login_name,globals.twitter_password); //httpCode 200 is ok
var result_raw = poster.getPageData()

Here is condensed results - “??” being where I put the Japanese:

result_raw {“text”:"Java Test Twitter API - Servoy ??:

Thanks

Steve

A case already exists in the support system for this issue.
This problem has also been reported here (and I requested a case for that thread as well):

Ill take your word for it. That support issue was for plugins.http.getPageData . I didn’t see plugins.http.getPoster mentioned. Or maybe I should assume your going over all the “HTTP” plugin tree for utf8? If thats the case Ill wait until thats finished. Thanks.

Steve

The case I am talking about says:
“Can’t do Japanese - UTF-8 plugins.http.getPoster .doPost Twitter API”

The issue is corrected in Servoy 4.0 rc2 and Servoy 3.5.7.

POST:
Posting to twitter required UTF-8 encoding. The default encoding used by the poster did not support Japanese/Chinese characters.
So now you can specify the encoding you want to use for posting - using poster.setEncoding(…). If you do not specify an encoding it will use the new default one (UTF-8).

GET PAGE DATA:
Added a plugins.http.getLastPageEncoding() function that will allow you to find out what encoding the page had when received (although the data is already decoded, you might need the initial encoding in some cases - see sample).
There was also a problem with getting page data without using a http client - the data was not decoded correctly in some cases. This is fixed too.

Here is a link to the new http.jar - make a backup copy of the old jar (from your 3.5 install) and replace it with this one.
http://www.servoy.com/downloads/downloads/bean_plugin/http.jar
Tell me if you still experience problems. :wink:

Renamed the functions from poster.setEncoding(…) to poster.setCharset(…) and from plugins.http.getLastPageEncoding() to plugins.http.getLastPageCharset() in order to avoid some confusion that might appear - as encoding is not only used for charsets in http headers. The old functions only appear in Servoy 4.0 rc2, and are deprecated in rc3.

The new ones will appear in Servoy 4.0 rc3 and Servoy 3.5.7.