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 8838531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:01:14+00:00 2026-06-14T10:01:14+00:00

I am decoding a string öçÇşŞükrÜ to some other charset. I encountered some interesting

  • 0

I am decoding a string “öçÇşŞükrÜ” to some other charset.

I encountered some interesting problem and want to learn how I can solve it.

>>> "öçÇşŞükrÜ".decode("utf-8")
u'\xf6\xe7\xc7\u015f\u015e\xfckr\xdc'
>>> "öçÇşŞükrÜ".decode("utf-8").encode("utf-8")
'\xc3\xb6\xc3\xa7\xc3\x87\xc5\x9f\xc5\x9e\xc3\xbckr\xc3\x9c'


>>> import chardet
>>> chardet.detect('\xc3\xb6\xc3\xa7\xc3\x87\xc5\x9f\xc5\x9e\xc3\xbckr\xc3\x9c')
{'confidence': 0.99, 'encoding': 'utf-8'}
>>> chardet.detect("öçÇşŞükrÜ")
{'confidence': 0.99, 'encoding': 'utf-8'}

What I do not understand and can not find is how to retrieve the original string “öçÇşŞükrÜ” with an decode and encode process with Python ?

  • 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-14T10:01:15+00:00Added an answer on June 14, 2026 at 10:01 am

    I am decoding a string “öçÇşŞükrÜ” to some other charset.

    No, you’re decoding an encoded string into an in-memory Unicode representation. Sorry if that sounds harsh, but IMHO it’s really important to get the basics right with Unicode and not just fumble around until something works. EDIT: The resources in the comments, https://www.youtube.com/watch?v=sgHbC6udIqc and http://www.joelonsoftware.com/articles/Unicode.html are also essential. Read and watch them. What you need to know is that nothing on disk, or in your terminal is Unicode. Everything is encoded, using one encoding or another.

    If you are using Linux, you’re lucky! (Us Windows devs… well, world of pain, etc.) Your console will most likely be UTF-8, so doing

    "öçÇşŞükrÜ".decode("UTF-8")
    

    will probably make sense.

    Did you try

    print "öçÇşŞükrÜ".decode("UTF-8").encode("UTF-8")
    

    (that is, with print applied)? You should then get your original öçÇşŞükrÜ back.

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

Sidebar

Related Questions

While decoding,I am getting NSData bytes by decoding a string.I am converting NSData bytes
I tried decoding this base64 string so many times but every time i get
When decoding/encoding a utf8 string using json_encode/json_decode I do not get back the string
I have a problem decoding HTML entities. I have tried using both System.Net.WebUtility.HtmlDecode() and
I'm having some trouble decoding & to & within a mail function: This is
I have a strange situation which I hope someone can shed some light on.
I'm having some strange issues with decoding an XML snippet, contained with a cookie,
What confuses me is decoding of HTTP header values . Example Header: Some-Header: quoted
After playing around with URL decoding myself, I managed to come up with some
I was thinking about creating a class (like String, StringBuffer etc). This can be

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.