string still shows garbled characters after converting encoding from ascii to utf-8What is the best way to remove accents in a Python unicode string?Converting from a string to boolean in Python?Running unittest with typical test directory structureConvert a list of characters into a stringHow many bytes does one Unicode character take?Python: Converting from ISO-8859-1/latin1 to UTF-8UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128)convert string with UTF-16 and UTF-8 text to UTF-8Php, detecting the possible output encoding for an utf-8 characterConvert UTF-8 hexadecimal to regular character

Save terminal output to a txt file

How does NAND gate work? (Very basic question)

Transfer over $10k

Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?

Password expiration with Password manager

When and why did journal article titles become descriptive, rather than creatively allusive?

Why is this a valid proof for the harmonic series?

Unexpected email from Yorkshire Bank

How do you center multiple equations that have multiple steps?

Attending a conference where my ex-supervisor and his collaborator are present, should I attend?

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

Can I use 1000v rectifier diodes instead of 600v rectifier diodes?

Packet sniffer for MacOS Mojave and above

What are the spoon bit of a spoon and fork bit of a fork called?

How to back up a running Linode server?

How to reply this mail from potential PhD professor?

My ID is expired, can I fly to the Bahamas with my passport

Visa for volunteering in England

Can PCs use nonmagical armor and weapons looted from monsters?

Is it always OK to ask for a copy of the lecturer's slides?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

Meaning of "individuandum"

Was the ancestor of SCSI, the SASI protocol, nothing more than a draft?

Entropy as a function of temperature: is temperature well defined?



string still shows garbled characters after converting encoding from ascii to utf-8


What is the best way to remove accents in a Python unicode string?Converting from a string to boolean in Python?Running unittest with typical test directory structureConvert a list of characters into a stringHow many bytes does one Unicode character take?Python: Converting from ISO-8859-1/latin1 to UTF-8UnicodeEncodeError: 'ascii' codec can't encode character u'xa0' in position 20: ordinal not in range(128)convert string with UTF-16 and UTF-8 text to UTF-8Php, detecting the possible output encoding for an utf-8 characterConvert UTF-8 hexadecimal to regular character






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I converted a string



body = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'


with



bodys = bodys.encode('utf-8')


but I still see the garbled characters "=C3=A9"



this is a string parsed from an email body via IMapClient module.
Would you know if there is a way to convert to readable characters?



many thanks!










share|improve this question



















  • 1





    Those are all UTF8 (even ASCII) chars.

    – CristiFati
    Mar 22 at 20:21











  • What where you expecting to convert them into?

    – Danielle M.
    Mar 22 at 20:22

















0















I converted a string



body = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'


with



bodys = bodys.encode('utf-8')


but I still see the garbled characters "=C3=A9"



this is a string parsed from an email body via IMapClient module.
Would you know if there is a way to convert to readable characters?



many thanks!










share|improve this question



















  • 1





    Those are all UTF8 (even ASCII) chars.

    – CristiFati
    Mar 22 at 20:21











  • What where you expecting to convert them into?

    – Danielle M.
    Mar 22 at 20:22













0












0








0








I converted a string



body = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'


with



bodys = bodys.encode('utf-8')


but I still see the garbled characters "=C3=A9"



this is a string parsed from an email body via IMapClient module.
Would you know if there is a way to convert to readable characters?



many thanks!










share|improve this question
















I converted a string



body = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'


with



bodys = bodys.encode('utf-8')


but I still see the garbled characters "=C3=A9"



this is a string parsed from an email body via IMapClient module.
Would you know if there is a way to convert to readable characters?



many thanks!







python email encoding






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 20:22









roganjosh

7,32831530




7,32831530










asked Mar 22 at 20:20









Martin HorstMartin Horst

113




113







  • 1





    Those are all UTF8 (even ASCII) chars.

    – CristiFati
    Mar 22 at 20:21











  • What where you expecting to convert them into?

    – Danielle M.
    Mar 22 at 20:22












  • 1





    Those are all UTF8 (even ASCII) chars.

    – CristiFati
    Mar 22 at 20:21











  • What where you expecting to convert them into?

    – Danielle M.
    Mar 22 at 20:22







1




1





Those are all UTF8 (even ASCII) chars.

– CristiFati
Mar 22 at 20:21





Those are all UTF8 (even ASCII) chars.

– CristiFati
Mar 22 at 20:21













What where you expecting to convert them into?

– Danielle M.
Mar 22 at 20:22





What where you expecting to convert them into?

– Danielle M.
Mar 22 at 20:22












1 Answer
1






active

oldest

votes


















2














You have a quopri (quoted printable) string there.



To get a text string out of that you must:



>>> import codecs
>>> s = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
>>> s_binary = s.encode('UTF-8')
>>> s_binary
b'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
>>> s_utf8 = codecs.decode(s_binary, 'quopri')
>>> s_utf8
b'e nxc3xa3o xc3xa9 o xc3xbanico autor a poder aceitxc3xa1-la'
>>> s_text = s_utf8.decode('UTF-8')
>>> s_text
'e não é o único autor a poder aceitá-la'


Or putting it all together:



>>> codecs.decode(s.encode('UTF-8'), 'quopri').decode('UTF-8')
'e não é o único autor a poder aceitá-la'





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307255%2fstring-still-shows-garbled-characters-after-converting-encoding-from-ascii-to-ut%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You have a quopri (quoted printable) string there.



    To get a text string out of that you must:



    >>> import codecs
    >>> s = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
    >>> s_binary = s.encode('UTF-8')
    >>> s_binary
    b'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
    >>> s_utf8 = codecs.decode(s_binary, 'quopri')
    >>> s_utf8
    b'e nxc3xa3o xc3xa9 o xc3xbanico autor a poder aceitxc3xa1-la'
    >>> s_text = s_utf8.decode('UTF-8')
    >>> s_text
    'e não é o único autor a poder aceitá-la'


    Or putting it all together:



    >>> codecs.decode(s.encode('UTF-8'), 'quopri').decode('UTF-8')
    'e não é o único autor a poder aceitá-la'





    share|improve this answer



























      2














      You have a quopri (quoted printable) string there.



      To get a text string out of that you must:



      >>> import codecs
      >>> s = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
      >>> s_binary = s.encode('UTF-8')
      >>> s_binary
      b'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
      >>> s_utf8 = codecs.decode(s_binary, 'quopri')
      >>> s_utf8
      b'e nxc3xa3o xc3xa9 o xc3xbanico autor a poder aceitxc3xa1-la'
      >>> s_text = s_utf8.decode('UTF-8')
      >>> s_text
      'e não é o único autor a poder aceitá-la'


      Or putting it all together:



      >>> codecs.decode(s.encode('UTF-8'), 'quopri').decode('UTF-8')
      'e não é o único autor a poder aceitá-la'





      share|improve this answer

























        2












        2








        2







        You have a quopri (quoted printable) string there.



        To get a text string out of that you must:



        >>> import codecs
        >>> s = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
        >>> s_binary = s.encode('UTF-8')
        >>> s_binary
        b'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
        >>> s_utf8 = codecs.decode(s_binary, 'quopri')
        >>> s_utf8
        b'e nxc3xa3o xc3xa9 o xc3xbanico autor a poder aceitxc3xa1-la'
        >>> s_text = s_utf8.decode('UTF-8')
        >>> s_text
        'e não é o único autor a poder aceitá-la'


        Or putting it all together:



        >>> codecs.decode(s.encode('UTF-8'), 'quopri').decode('UTF-8')
        'e não é o único autor a poder aceitá-la'





        share|improve this answer













        You have a quopri (quoted printable) string there.



        To get a text string out of that you must:



        >>> import codecs
        >>> s = 'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
        >>> s_binary = s.encode('UTF-8')
        >>> s_binary
        b'e n=C3=A3o =C3=A9 o =C3=BAnico autor a poder aceit=C3=A1-la'
        >>> s_utf8 = codecs.decode(s_binary, 'quopri')
        >>> s_utf8
        b'e nxc3xa3o xc3xa9 o xc3xbanico autor a poder aceitxc3xa1-la'
        >>> s_text = s_utf8.decode('UTF-8')
        >>> s_text
        'e não é o único autor a poder aceitá-la'


        Or putting it all together:



        >>> codecs.decode(s.encode('UTF-8'), 'quopri').decode('UTF-8')
        'e não é o único autor a poder aceitá-la'






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 20:30









        Anthony SottileAnthony Sottile

        21.3k64776




        21.3k64776





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307255%2fstring-still-shows-garbled-characters-after-converting-encoding-from-ascii-to-ut%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현