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;
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
add a comment |
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
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
add a comment |
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
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
python email encoding
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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'
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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'
add a comment |
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'
add a comment |
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'
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'
answered Mar 22 at 20:30
Anthony SottileAnthony Sottile
21.3k64776
21.3k64776
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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