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
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
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
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
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
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
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 request a string. Then I need know the length of