<div dir="ltr">Sorry wrong list!<div>Could this be deleted in any way?</div><div><br></div><div>-Lauri</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 22, 2015 at 10:36 AM, Lauri Kajan <span dir="ltr"><<a href="mailto:lauri.kajan@gmail.com" target="_blank">lauri.kajan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I'm trying to figure out some encoding problems when using custom python expression functions.</div><div><br></div><div>I'm using python functions for defining some label texts. I need use some special characters like ä and ö.</div><div><br></div><div>When a new file is created in function editor the file is encoded in my system encoding cp1252. At least the ä is coded to 0xe4 if I check that with hex-editor.</div><div>Let the custom function just be</div><div><div>@qgsfunction(args='auto', group='Custom')</div><div>def encodingtest(feature, parent):</div><div><span style="white-space:pre-wrap"> </span>return 'ä'</div></div><div><br></div><div>This displays on a map like 'ä'</div><div>It seems that the file is converted to utf-8 before execution and the ä is then coded to 0xc3 0xa4. Now QGIS still tries to interpret this as cp1252 and then displays this as 'ä'.</div><div><br></div><div>It doesn't help to define the ä as unicode like u'ä' because QGIS still sees the ä as 0xc3 0xa4 and think that it is in cp1252.</div><div><br></div><div>The only way to resolve this in the code at least that I have found is to use</div><div>return 'ä'.decode('utf-8')</div><div>This works on QGIS but the file can't be executed elsewhere (IDE) since the file is truly in cp1252 and 0xe4 can't be decoded using utf-8.</div><div><br></div><div><br></div><div>Does anyone else confirm this and have I understood right the problem?</div><div>Should I file a bug report?</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>-Lauri</div></div>
</blockquote></div><br></div>