Latest recipes tagged "mazovia" Code RecipesMazovia encoding for Polish text from MS-DOS era (Python) 2012-02-15T09:24:13-08:00Michal Niklas <p style="color: grey"> Python recipe 578040 by <a href="/recipes/users/186902/">Michal Niklas</a> (<a href="/recipes/tags/encoding/">encoding</a>, <a href="/recipes/tags/mazovia/">mazovia</a>, <a href="/recipes/tags/polish/">polish</a>). </p> <p>Some MS-DOS era text or databases in Poland use Mazovia encoding for letters such as: ą, ę, ś, ż, ź. It is very well described on Polish wikipedia: <a href="" rel="nofollow"></a></p> <p>There is <code></code> with Polish encoding. Copy it to the Python <code>Lib/encodings</code> directory. Tested with Python 2.7. For Python 3.2 I had to remove unicode string u prefix.</p> <p>Usage:</p> <pre class="prettyprint"><code>def conv_file(fname): f =, 'rb', 'mazovia') s = f.close() f = + '_utf8', 'wb', 'utf8') f.write(s) f.close() </code></pre>