Bug report #19124
UTF-8 characters not supported in python script despite # -*- coding: utf-8 -*-
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | PyQGIS Console | ||
Affected QGIS version: | 3.0.3 | Regression?: | No |
Operating System: | Win64 | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | worksforme |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 26954 |
Description
The following lines generate an error "SyntaxError: invalid character in identifier"
ϕ = radians(latitude)
λ = radians(longitude)
#!/usr/bin/env python
coding: utf-8
History
#1 Updated by Matthias Kuhn over 6 years ago
- Status changed from Open to Feedback
Please provide a full minimal working example.
#2 Updated by Yannick Portier over 6 years ago
- File GeodeticToGeocentric.py added
Here is a code sample
#3 Updated by Jürgen Fischer about 6 years ago
- Resolution set to worksforme
- Status changed from Feedback to Closed
Pasting this into the python console works fine for me - both on Windows and Linux. On the command line you have to make sure that you're actually using python3 ad python2 doesn't support non-ascii identifiers (ie. on OSGeo4W by running call py3_env.bat
. On Linux you might need #!/usr/bin/env python3
is python 2 is otherwise used).