Jason (krolain) wrote in lj_clients,

  • Mood:

Posting special characters in Music and Mood fields in XML-RPC

Evening everyone.

I have some information I'd like to share with some of you. I know some of you, like me, have been trying to figure out how to post non-english characters in the mood and music field of LJ though the XML-RPC protocol. Well, after a good six hours of fooling around, I figured it out.

The best way is to encode the text into base64-encoded binary. I stumbled upon this answer when one of my post ended up being sent to me in binary. I knew it was text since it was a post that I used the 'é' character. Once I decoded the binary into bytes, then UTF-8 decoded that, the text appeared correctly.

So, the way to do it is:
1. UTF-8 byte encode the text
2. Encode the bytes into base64-encoded binary

That seems to work! :-) I may use base64 binary for all my text posting onto LJ! Though, this may be only needed for the music and mood field, since so far, the subject and event fields handle non-english characters. However, if you have problem with any valid unicode characters, try this method and see what happens.

However, if you this, ensure that your XML-RPC handler can decode the base64 binary back into text, since LJ will send back those field in base64 binary.

  • 302: lj_dev

    In the interests of consolidating all LiveJournal development-related discussion, we're going to be closing down this community. The same…

  • Plain text to LJ

    I have an old blog from xanga that's in html/plain text and I want to move it over here. Which client would be the best to do this? I also want to…

  • ljKlient 0.2.0 Preview Release 1

    Today marks another milestone in the development of ljKlient — as the first preview of the 0.2 series is released.  Please go to the project…

  • Post a new comment


    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened