willie <[EMAIL PROTECTED]> writes:
> >>> ustr = buf.decode('UTF-8')
> >>> type(ustr)
>
> Is it a "unicode object that contains a UTF-8 encoded
> string object?"
No, it's just unicode, which is a string over a certain character set.
UTF-8 is a way to encode unicode strings as byte strings.
You
willie wrote:
>
> Thanks for the thorough explanation. One last question
> about terminology then I'll go away :)
> What is the proper way to describe "ustr" below?
>
> >>> ustr = buf.decode('UTF-8')
> >>> type(ustr)
>
>
>
> Is it a "unicode object that contains a UTF-8 encoded
> string object?
At Wednesday 20/9/2006 19:53, willie wrote:
What is the proper way to describe "ustr" below?
>>> ustr = buf.decode('UTF-8')
>>> type(ustr)
Is it a "unicode object that contains a UTF-8 encoded
string object?"
ustr is an unicode object. Period. An unicode object contains
characters (not
MonkeeSage wrote:
> OK, so the devil always loses. ;P
>
> Regards,
> Jordan
Huh? The devil always loses? *turns TV on, watches the news, turns TV
off* Nope, buddy. Quite the contrary.
--
http://mail.python.org/mailman/listinfo/python-list
willie schrieb:
> Thank you for your patience and for educating me.
> (Though I still have a long way to go before enlightenment)
> I thought Python might have a small weakness in
> lacking an efficient way to get the number of bytes
> in a "UTF-8 encoded Python string object" (proper?),
> but I've
willie wrote:
> John Machin:
>
> >You are confusing the hell out of yourself. You say that your web app
> >deals only with UTF-8 strings. Where do you get "the unicode string"
> >from??? If name is a utf-8 string, as your comment says, then len(name)
> >is all you need!!!
>
>
> # I'll go ah
willie wrote:
> John Machin:
>
> >You are confusing the hell out of yourself. You say that your web app
> >deals only with UTF-8 strings. Where do you get "the unicode string"
> >from??? If name is a utf-8 string, as your comment says, then len(name)
> >is all you need!!!
>
>
> # I'll go ahead
willie wrote:
> >willie wrote:
> >> Marc 'BlackJack' Rintsch:
> >>
> >> >In <[EMAIL PROTECTED]>, willie
> wrote:
> >> >> # What's the correct way to get the
> >> >> # byte count of a unicode (UTF-8) string?
> >> >> # I couldn't find a builtin method
> >> >> # and the following is memory
OK, so the devil always loses. ;P
Regards,
Jordan
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth <[EMAIL PROTECTED]> writes:
> I guess you could invent something like inserting a string into a database
> which has fixed size fields, silently truncates fields which are too long
> and stores the strings internally in utf-8 but only accepts ucs-2 in its
> interface. Pretty far fet
"MonkeeSage" <[EMAIL PROTECTED]> wrote:
> John Machin wrote:
>> The answer is, "You can't", and the rationale would have to be that
>> nobody thought of a use case for counting the length of the UTF-8 form
>> but not creating the UTF-8 form. What is your use case?
>
> Playing DA here, what if yo
MonkeeSage schrieb:
> John Machin wrote:
>> The answer is, "You can't", and the rationale would have to be that
>> nobody thought of a use case for counting the length of the UTF-8 form
>> but not creating the UTF-8 form. What is your use case?
>
> Playing DA here, what if you need to send the by
John Machin wrote:
> The answer is, "You can't", and the rationale would have to be that
> nobody thought of a use case for counting the length of the UTF-8 form
> but not creating the UTF-8 form. What is your use case?
Playing DA here, what if you need to send the byte-count on a server
via a he
willie wrote:
> Marc 'BlackJack' Rintsch:
>
> >In <[EMAIL PROTECTED]>, willie wrote:
> >> # What's the correct way to get the
> >> # byte count of a unicode (UTF-8) string?
> >> # I couldn't find a builtin method
> >> # and the following is memory inefficient.
>
> >> ustr = "example\xC2\x9D"
In <[EMAIL PROTECTED]>, willie wrote:
> # What's the correct way to get the
> # byte count of a unicode (UTF-8) string?
> # I couldn't find a builtin method
> # and the following is memory inefficient.
>
> ustr = "example\xC2\x9D".decode('UTF-8')
>
> num_chars = len(ustr)# 8
>
> buf = ustr.
willie wrote:
> # What's the correct way to get the
> # byte count of a unicode (UTF-8) string?
> # I couldn't find a builtin method
> # and the following is memory inefficient.
>
> ustr = "example\xC2\x9D".decode('UTF-8')
>
> num_chars = len(ustr)# 8
>
> buf = ustr.encode('UTF-8')
>
> num_byte
16 matches
Mail list logo