Anton Frolov
Anton Frolov

Reputation: 291

Livejournal XML-RPC protocol mismatch

I have the following Perl script:

use strict;
use XML::RPC;
use Digest::MD5 qw(md5_hex);
use 5.010;

my ($username, $password)  = qw(foo bar);
my $xmlrpc = XML::RPC->new('http://www.livejournal.com/interface/xmlrpc', (output_encoding => 'UTF-8' ));
my $result = $xmlrpc->call( 'LJ.XMLRPC.getevents', { username => $username, hpassword => md5_hex($password), selecttype => "syncitems"} );

However, the server responds with 207 error: Client error: Protocol version mismatch: Cannot display/edit a Unicode post with a non-Unicode client. Please see http://www.livejournal.com/support/encodings.bml for more information.

According to the API specification LJ should work with UTF-8. So I don't understand what am I doing wrong.

Upvotes: 2

Views: 414

Answers (1)

Anton Frolov
Anton Frolov

Reputation: 291

Okay, I solved it. The problem was that I didn't specify optional (that's why I didn't notice it the first place) parameter ver that defaults to 0 and should be assigned 1 in the case the data contains non-ASCII symbols.

Upvotes: 3

Related Questions