Дима Рубинштейн (dimrub) wrote in lj_dev,
Дима Рубинштейн

Encodings and a client

Hi, all!

I've hacked together a GreaseMonkey script that cross posts entries from Vox to LJ. Everything works fine, until I try to post Unicode stuff. It seems to go through OK (with Unicode chars encoded by the encodeURIComponent function each into something like this: %XX%XX), and the entry appears just fine in the friends list, but then I can't edit it, and I get the following when I try to:

Client error: Invalid text encoding: Cannot display this post. Please see http://www.livejournal.com/support/encodings.bml for more information.

So I tried using escape() instead, which results in each Unicode char being encoded as %uXXXX instead of %XX%XX - and now the text is presented as is, in the encoded form. I also tried omitting encoding altogether (only escaping the ampersand), with the same result as with encodeURIComponent. Question is, what does LJ expect to see there exactly (and, perhaps, how to achieve it in JavaScript)?

Tags: client, client: posting, code: javascript

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded