A few questiosn about encoding

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jun 12 20:13:34 EDT 2013


On Wed, 12 Jun 2013 14:23:49 +0300, Νικόλαος Κούρας wrote:

> So, how many bytes does UTF-8 stored for codepoints > 127 ?

Two, three or four, depending on the codepoint.


> example for codepoint 256, 1345, 16474 ?

You can do this yourself. I have already given you enough information in 
previous emails to answer this question on your own, but here it is again:

Open an interactive Python session, and run this code:

c = ord(16474)
len(c.encode('utf-8'))


That will tell you how many bytes are used for that example.



-- 
Steven



More information about the Python-list mailing list