Python Forum
# of bytes used to store a Unicode character
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
# of bytes used to store a Unicode character
#1
I read somewhere that Python 3 uses 2 or 4 byte Unicode characters depending on how the particular implementation was built.

1. Does Python 3 always use 2 or 4 bytes by default?

2. How can I check my system to determine which size is actually being used?

Thanks.
Reply
#2
By default, Python 3.0+ uses UTF-8. UTF-8 does not have a consistent character width. Details on the default are here.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
do you happen to know whether any python implementations default to an encoding other than UTF-8?
Reply
#4
I have no idea.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  width of Unicode character Skaperen 6 2,705 Sep-27-2021, 12:41 AM
Last Post: Skaperen
  [solved] unexpected character after line continuation character paul18fr 4 3,388 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,159 Jul-13-2020, 07:05 PM
Last Post: snippsat
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,732 Jan-05-2020, 11:50 AM
Last Post: vivekagrey
  Replace changing string including uppercase character with lowercase character silfer 11 6,174 Mar-25-2019, 12:54 PM
Last Post: silfer
  replace bytes with other byte or bytes BigOldArt 1 10,607 Feb-02-2019, 11:00 PM
Last Post: snippsat
  clean unicode string to contain only characters from some unicode blocks gmarcon 2 3,964 Nov-23-2018, 09:17 PM
Last Post: Gribouillis
  How to specify a Unicode character with Autokey keyboard.sendkeys()? ineuw 5 5,908 Nov-04-2017, 08:43 PM
Last Post: ineuw
  SyntaxError: unexpected character after line continuation character Saka 2 18,547 Sep-26-2017, 09:34 AM
Last Post: Saka
  Unicode character search Larz60+ 2 16,206 Apr-25-2017, 01:53 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020