https://issues.qgis.org/https://issues.qgis.org/favicon.ico2018-08-31T14:36:18ZQGIS Issue TrackingQGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=923722018-08-31T14:36:18ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Category</strong> changed from <i>Unknown</i> to <i>Expressions</i></li></ul> QGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=924532018-09-03T07:14:31ZJérôme Seigneuretjerome.seigneuret@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This error are caused by encoding file...</p>
<p>I have create expression in an old version and I don't understand why but file is in ANSI and not utf-8. I convert encoding with Notepad++ and all work fine.</p>
<p>It's possible to add analyse on encoding file if it's not identical to header declaration or/and default encoding?</p> QGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=924592018-09-03T08:41:46ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Resolution</strong> set to <i>invalid</i></li></ul> QGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=924792018-09-03T12:36:17ZHarrissou Santanna
<ul></ul><blockquote>
<p>2018-08-31T15:05:56 WARNING L'expression de l'utilisateur base_water_function n'est pas valide</p>
</blockquote>
<p>L'utilisateur s'appelle <strong>base_water_function</strong> ou c'est une mauvaise traduction et c'est plutôt le nom de la fonction?</p> QGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=924832018-09-03T13:12:08ZJérôme Seigneuretjerome.seigneuret@gmail.com
<ul></ul><p>Harrissou Santanna wrote:</p>
<blockquote><blockquote>
<p>2018-08-31T15:05:56 WARNING L'expression de l'utilisateur base_water_function n'est pas valide</p>
</blockquote>
<p>L'utilisateur s'appelle <strong>base_water_function</strong> ou c'est une mauvaise traduction et c'est plutôt le nom de la fonction?</p>
</blockquote>
<p>Sorry for french resume but I think this is an error of translation same as @Harrissou</p>
<p>Il y a peut être une erreur de traduction. En fait je dirais :</p>
<p>"Le fichier d'expression utilisateur base_water_function n'est pas valide"</p>
<p>File have same name as user expression file listed in fonction (normaly) but there is really a problem because ther is no analyse to check if name are valid or not with file system. I think this message need to be a new issue.</p>
<p>\\ is a valide expression file name! file stored ... I don't no where because there is no file in folder<br />// is a valide expression file name! file stored is .py</p> QGIS Application - Bug report #19742: accentued caracters make problem to load python expression script https://issues.qgis.org/issues/19742?journal_id=924852018-09-03T13:39:23ZJérôme Seigneuretjerome.seigneuret@gmail.com
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>I understand why my fucntion don't work</p>
<p>When I load function file it is save in local encoding and not in utf-8</p>
<p>so when I reopen it on notepad++ this looks like to that</p>
<pre>
# -*- coding: utf-8 -*-
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def get_pipe_material_code_fr(v,feature, parent):
"""
read and replace value by code
"""
if v == "Fonte":
return "F"
elif v == "Pvc":
return "PVC"
elif v == "inconnu":
return "?"
elif v == "Poly굨yl鯥":
return "PE"
else:
return "X"
</pre>
<p>This comportment is on all scripts... But not all my script contains non ascii caracters. This is the why I don't detect that before</p>