Re: About size of Unicode string

2005-06-13 Thread Fredrik Lundh
Frank Abel Cancio Bello wrote: > Can I get how many bytes have a string object independently of its encoding? strings hold characters, not bytes. an encoding is used to convert a stream of characters to a stream of bytes. if you need to know the number of bytes needed to hold an encoded string

RE: About size of Unicode string

2005-06-06 Thread Frank Abel Cancio Bello
rg > Subject: Re: About size of Unicode string > > Frank Abel Cancio Bello wrote: > > request.add_header('content-encoding', 'UTF-8') > > The Content-Encoding header is for things like "gzip", not for > specifying the text encoding. Use the

Re: About size of Unicode string

2005-06-06 Thread Leif K-Brooks
Frank Abel Cancio Bello wrote: > request.add_header('content-encoding', 'UTF-8') The Content-Encoding header is for things like "gzip", not for specifying the text encoding. Use the charset parameter to the Content-Type header for that, as in "Content-Type: text/plain; charset=utf-8". -- ht

RE: About size of Unicode string

2005-06-06 Thread Andrew Dalke
Frank Abel Cancio Bello wrote: > Can I get how many bytes have a string object independently of its encoding? > Is the "len" function the right way of get it? No. len(unicode_string) returns the number of characters in the unicode_string. Number of bytes depends on how the unicode character are

RE: About size of Unicode string

2005-06-06 Thread Frank Abel Cancio Bello
rue that "the size of the entity-body" is "len(data)" independently of the encoding of "data"? > -Original Message- > From: Laszlo Zsolt Nagy [mailto:[EMAIL PROTECTED] > Sent: Monday, June 06, 2005 1:43 PM > To: Frank Abel Cancio Bello; python-list@p

Re: About size of Unicode string

2005-06-06 Thread Laszlo Zsolt Nagy
Frank Abel Cancio Bello wrote: >Hi all! > >I need know the size of string object independently of its encoding. For >example: > > len('123') == len('123'.encode('utf_8')) > >while the size of '123' object is different of the size of >'123'.encode('utf_8') > >More: >I need send in HTTP reques