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

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript