Changes between Version 6 and Version 7 of FrequentlyAskedQuestions

12/05/06 04:11:55 (15 years ago)



  • FrequentlyAskedQuestions

    v6 v7  
    162162=== Why don't Twisted's network methods support Unicode objects as well as strings? ===
     164In general, such methods (e.g. [ FileDescriptor]'s write) are designed to send bytes over the network. These methods use non-Unicode string objects as a container for the bytes that they send and receive.
     166Unicode objects are not byte-based and are an abstraction used for representing strings of human readable text. In order to send Unicode strings using these methods, you should explicitly specify a byte-based encoding for them, for example: s.encode("utf-8") and explicitly decode them at the receiving end.
     168Twisted cannot choose an encoding for you at this level: your encoding choice will be protocol specific and may need to be specified in the message you send (for example, HTTP headers include a encoding specification).
     170For a more complete discussion of the distinction between Unicode strings and specific encodings of Unicode strings, see the following articles:
     172    * Dan Sugalski's [ What the heck is: A string]; and
     173    * Joel Spolsky's [ The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)].
    163175== Perspective Broker ==
    164177=== How can I get the reference to a client from a Perspective? ===
     179Firstly, the client must send a reference when it connects to the perspective broker. This can be done by passing the reference as a parameter to [ pb.connect].
     181At the server end, you must override the [ Perspective.attach], which is called when a client attaches to a perspective. The first argument of this method is a remote reference to the client object that was passed to [ pb.connect].
     183Note that a single perspective can have many attached clients. For further information, see [ Managing Clients of Perspectives] HOWTO and the [ twisted.spread.pb] API docs.
    165185== Requests and Contributing ==
    166186=== Twisted is cool, but I need to add more functionality. ===