A few questiosn about encoding

Joel Goldstick joel.goldstick at gmail.com
Fri Jun 14 11:21:39 EDT 2013


let's cut to the chase and start with telling us what you DO know Nick.
That would take less typing


On Fri, Jun 14, 2013 at 9:58 AM, Nick the Gr33k <support at superhost.gr>wrote:

> On 14/6/2013 1:14 μμ, Cameron Simpson wrote:
>
>> Normally a character in a b'...' item represents the byte value
>> matching the character's Unicode ordinal value.
>>
>
> The only thing that i didn't understood is this line.
> First please tell me what is a byte value
>
>
>  \x1b is a sequence you find inside strings (and "byte" strings, the
>> b'...' format).
>>
>
> \x1b is a character(ESC) represented in hex format
>
> b'\x1b' is a byte object that represents what?
>
>
> >>> chr(27).encode('utf-8')
> b'\x1b'
>
> >>> b'\x1b'.decode('utf-8')
> '\x1b'
>
> After decoding it gives the char ESC in hex format
> Shouldn't it result in value 27 which is the ordinal of ESC ?
>
> > No, I mean conceptually, there is no difference between a code-point
>
> > and its ordinal value. They are the same thing.
>
> Why Unicode charset doesn't just contain characters, but instead it
> contains a mapping of (characters <--> ordinals) ?
>
> I mean what we do is to encode a character like chr(65).encode('utf-8')
>
> What's the reason of existence of its corresponding ordinal value since it
> doesn't get involved into the encoding process?
>
> Thank you very much for taking the time to explain.
>
> --
> What is now proved was at first only imagined!
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130614/628c7bbf/attachment.html>


More information about the Python-list mailing list