<div dir="ltr"><div>reťazec je vystup z db, ktorý potrebujem ďalej spracovať. <br>rezatec.encode("cp1250").decode("cp1250") (v aplikacii) <br></div>skončí hláškou:<br>UnicodeEncodeError: 'charmap' codec can't encode character '\xe8' in position 4: character maps to <undefined><br>
<div><div><input value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"expires":false},"attachments":{}}" name="virtru-metadata" type="hidden"></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-14 16:17 GMT+02:00 Petr Messner <span dir="ltr"><<a href="mailto:petr.messner@gmail.com" target="_blank">petr.messner@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Metody encode a decode v Pythonu 3.4 normálně fungují:<div><br></div><div><div>>>> "ěšč".encode("cp1250")</div>
<div>b'\xec\x9a\xe8'</div><div>>>> "ěšč".encode("cp1250").decode("cp1250")</div>
<div>'ěšč'</div></div><div><br></div><div>PM</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">2014-08-14 15:58 GMT+02:00 Zdenko Podobný <span dir="ltr"><<a href="mailto:zdposter@gmail.com" target="_blank">zdposter@gmail.com</a>></span>:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Ahojte,<div><div class="h5"><br><br>ako prekodovat cp1250 retazec do utf-8 v pythone 3.4.1?<br>
</div></div></div><div><div class="h5">V 2.7 to bolo jednoduche: retazec.decode('cp1250').<br>
</div></div></div><div><div class="h5">Retazec je vystup z databazy cez pyodbc, kde neviem ovplyvnit kodovanie...<br>
<br>--<br></div></div></div>Zdenko<br><div><div><div><br><div><input value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"expires":false},"attachments":{}}" name="virtru-metadata" type="hidden"></div>
</div></div></div></div>
<br><div class="">_______________________________________________<br>
Python mailing list<br>
<a href="mailto:python@py.cz" target="_blank">python@py.cz</a><br>
<a href="http://www.py.cz/mailman/listinfo/python" target="_blank">http://www.py.cz/mailman/listinfo/python</a><br>
<br>
Visit: <a href="http://www.py.cz" target="_blank">http://www.py.cz</a><br></div></blockquote></div><br></div></div>
<br>_______________________________________________<br>
Python mailing list<br>
<a href="mailto:python@py.cz">python@py.cz</a><br>
<a href="http://www.py.cz/mailman/listinfo/python" target="_blank">http://www.py.cz/mailman/listinfo/python</a><br>
<br>
Visit: <a href="http://www.py.cz" target="_blank">http://www.py.cz</a><br></blockquote></div><br></div>