Changes between Version 6 and Version 7 of FrequentlyAskedQuestions


Ignore:
Timestamp:
12/05/06 04:11:55 (15 years ago)
Author:
oubiwann
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FrequentlyAskedQuestions

    v6 v7  
    161161
    162162=== Why don't Twisted's network methods support Unicode objects as well as strings? ===
     163
     164In general, such methods (e.g. [http://twistedmatrix.com/documents/current/api/twisted.internet.abstract.FileDescriptor.html 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.
     165
     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.
     167
     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).
     169
     170For a more complete discussion of the distinction between Unicode strings and specific encodings of Unicode strings, see the following articles:
     171
     172    * Dan Sugalski's [http://www.sidhe.org/~dan/blog/archives/000255.html What the heck is: A string]; and
     173    * Joel Spolsky's [http://www.joelonsoftware.com/articles/Unicode.html The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)].
     174
    163175== Perspective Broker ==
     176
    164177=== How can I get the reference to a client from a Perspective? ===
     178
     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 [http://twistedmatrix.com/documents/current/api/twisted.spread.pb.connect.html pb.connect].
     180
     181At the server end, you must override the [http://twistedmatrix.com/documents/current/api/twisted.spread.pb.Perspective.attach.html 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 [http://twistedmatrix.com/documents/current/api/twisted.spread.pb.connect.html pb.connect].
     182
     183Note that a single perspective can have many attached clients. For further information, see [http://twistedmatrix.com/projects/core/documentation/howto/pclients.html Managing Clients of Perspectives] HOWTO and the [http://twistedmatrix.com/documents/current/api/twisted.spread.pb.html twisted.spread.pb] API docs.
     184
    165185== Requests and Contributing ==
    166186=== Twisted is cool, but I need to add more functionality. ===