Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:12:00+00:00 2026-06-09T06:12:00+00:00

I have a Korean string encoded as Unicode like u’정정’ . How do I

  • 0

I have a Korean string encoded as Unicode like u'정정'. How do I know how many bytes are needed to represent this string?

I need to know the exact byte count since I’m using the string for iOS push notification and it has a limit on the size of the payload.

len('정정') doesn’t work because that returns the number of characters, not the number of bytes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:12:02+00:00Added an answer on June 9, 2026 at 6:12 am

    You need to know what encoding you want to measure your byte size in:

    >>> print u'\uC815\uC815'
    정정
    >>> print len(u'\uC815\uC815')
    2
    >>> print len(u'\uC815\uC815'.encode('UTF-8'))
    6
    >>> print len(u'\uC815\uC815'.encode('UTF-16-LE'))
    4
    >>> print len(u'\uC815\uC815'.encode('UTF-16'))
    6
    >>> print len(u'\uC815\uC815'.encode('UTF-32-LE'))
    8
    >>> print len(u'\uC815\uC815'.encode('UTF-32'))
    12
    

    You really want to review the Python Unicode HOWTO to fully appreciate the difference between a unicode object and it’s byte encoding.

    Another excellent article is The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!), by Joel Spolsky (one of the people behind Stack Overflow).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Korean Unicode string ( ...입니다.<br /><br />소재... ) that I want
I have a Python Unicode string. I want to make sure it only contains
need some help from a regex jedi master: If I have a string of
Let's say I have two tables lnglngdef: lngId | lngName 1 Korean 2 Spanish
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I guess many people already read this article: Using your own SQLite database in
i have a listbox that is populated this way with two Databindings (Frage and
I have a file with Korean and chinese characters. I want to find pairs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.