Putting Unicode characters in JSON

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Mar 23 01:35:31 EDT 2018


On 2018年3月23日 12:05:34 +1100, Chris Angelico wrote:
> Latin-1 is not "arbitrary bytes". It is a very specific encoding that
> cannot decode every possible byte value.

Yes it can.
py> blob = bytes(range(256))
py> len(blob)
256
py> blob[45:55]
b'-./0123456'
py> s = blob.decode('latin1')
py> len(s)
256
py> s[45:55]
'-./0123456'
-- 
Steve


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /