Martin Atkins (mart) wrote in lj_dev,
Martin Atkins

URLEncoding with UTF-8

This is actually a client question, but since it's to do with stuff which is happening on the server, and the people who know the answers read this community a whole lot more than the clients community, I've asked here. Shoot me.

I was playing around with writing a Microsoft.NET library for LiveJournal clients. Now, I know about three other people at least are also doing this, but it was mostly just something productive to do while I was learning how it all fits together and learning the C# language, so I'm not trying to tread on anyone's toes.

One thing I'm trying to be aware of is that LiveJournal's going to be expecting UTF-8 soon. My first question is whether UTF-8 should be sent when $LJ::UNICODE is off on the server. Will the server be able to intelligently convert to some other encoding, or does that logic have to be client-side? (...and, in the latter case, will the server provide this information at login?)

My second question regards how to encode UTF-8 when doing URLencoding for the flat interface. My current logic gets a byte array using the UTF-8 encoder (part of the standard .NET class library) and then changes each individual byte into its hexidecimal encoding notation. The multi-byte characters get converted into two consecutive URL-encoded values, then. Is this correct operating procedure, or should I be doing something different?


  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded