Hi Joze<br><br><div class="gmail_quote">2011/4/24 Jože Detečnik <span dir="ltr"><<a href="mailto:joze.detecnik@jkp-sg.si">joze.detecnik@jkp-sg.si</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div link="blue" vlink="purple" lang="SL"><div><p class="MsoNormal">Hello,</p><p class="MsoNormal"> </p><p class="MsoNormal">I modified plugin by implemented like function. I use python Search function. It work with ASCII but not with UTF-8 character.</p>
<p class="MsoNormal">Can any body help me, because I just begin with python.</p><p class="MsoNormal"> </p><p class="MsoNormal">This work ASCII, error with UTF-8</p><p class="MsoNormal"> </p><p class="MsoNormal"># like</p>
<p class="MsoNormal"> elif operator == "like":</p><p class="MsoNormal"> while (provider.nextFeature(f)):</p><p class="MsoNormal"> fieldmap=f.attributeMap()</p><p class="MsoNormal">
if re.search (str (value),fieldmap[col].toString()):</p><p class="MsoNormal"> selection.append(<a href="http://f.id" target="_blank">f.id</a>())</p><p class="MsoNormal"><br></p></div></div></blockquote>
<div><br>I might want to have a deeper look at the str/unicode business in Python:<br><a href="http://farmdev.com/talks/unicode/">http://farmdev.com/talks/unicode/</a><br><br>What is the type of 'value' variable? Isn't it a QString by chance? If it is, then you would be probably better off by using QRegExp for the search. Or instead of doing str(value) that doesn't handle unicode characters correctly you should use unicode(value). Or if it is a utf-8 encoded string (or using other encoding) then decode it to a unicode string.<br>
<br>Martin<br><br></div></div>