Hacked-Crew / Magnetic-Declination

QGIS plugin
GNU General Public License v2.0
5 stars 9 forks source link

UnicodeEncodeError #1

Closed geodrinx closed 9 years ago

geodrinx commented 9 years ago

Hello Aldo,

I had this : Traceback (most recent call last): File "/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\u00B0'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

Hacked-Crew commented 9 years ago

Roberto,

I never had this in Win 7 e OSX 10.8.

Try to replace line 334, 335 in self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\N{DEGREE SIGN}'))) self.dlg.heading_lineEdit.setText(unicode(str(str(Rheading) + u'\N{DEGREE SIGN}')))

Please tell me if issue is resolved.

Bye H-C

2015-05-03 17:50 GMT+02:00 geodrinx notifications@github.com:

Hello Aldo,

I had this : Traceback (most recent call last): File "/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\u00B0'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

— Reply to this email directly or view it on GitHub https://github.com/Hacked-Crew/Magnetic-Declination/issues/1.

geodrinx commented 9 years ago

Aldo,

ho sostituito le due linee di codice, ma mi ritorna questo:

File "/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate

self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\N{DEGREE SIGN}'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

2015-05-03 18:22 GMT+02:00 Aldo Scorza notifications@github.com:

Roberto,

:D prova a sostituire il python allegato. e dimmi se funziona. io non ho mai ricevuto questo errore, Win 7 e OSX 10.8.

Ciao Aldo

2015-05-03 17:50 GMT+02:00 geodrinx notifications@github.com:

Hello Aldo,

I had this : Traceback (most recent call last): File

"/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\u00B0'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

— Reply to this email directly or view it on GitHub https://github.com/Hacked-Crew/Magnetic-Declination/issues/1.

— Reply to this email directly or view it on GitHub https://github.com/Hacked-Crew/Magnetic-Declination/issues/1#issuecomment-98499229 .

geodrinx commented 9 years ago

Non so se può essere utile, ma le coordinate che ho usato sono queste:

12.336593° 45.438243°

2015-05-03 19:22 GMT+02:00 Geo DrinX geodrinx@gmail.com:

Aldo,

ho sostituito le due linee di codice, ma mi ritorna questo:

File "/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate

self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\N{DEGREE SIGN}'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

2015-05-03 18:22 GMT+02:00 Aldo Scorza notifications@github.com:

Roberto,

:D prova a sostituire il python allegato. e dimmi se funziona. io non ho mai ricevuto questo errore, Win 7 e OSX 10.8.

Ciao Aldo

2015-05-03 17:50 GMT+02:00 geodrinx notifications@github.com:

Hello Aldo,

I had this : Traceback (most recent call last): File

"/Users/rrr/.qgis2/python/plugins/MagneticDeclination/Magnetic_declination.py", line 334, in simple_Calculate

self.dlg.declination_lineEdit.setText(unicode(str(str(self.Rdeclination) + u'\u00B0'))) UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 13: ordinal not in range(128)

— Reply to this email directly or view it on GitHub https://github.com/Hacked-Crew/Magnetic-Declination/issues/1.

— Reply to this email directly or view it on GitHub https://github.com/Hacked-Crew/Magnetic-Declination/issues/1#issuecomment-98499229 .

Hacked-Crew commented 9 years ago

Ok Roberto,

that issue is generated because characters greater than 127 will cause an exception in unicode string. i think the solution is replace again the lines 334 and 335 in

self.dlg.declination_lineEdit.setText(str(self.Rdeclination) + u'\N{DEGREE SIGN}') self.dlg.heading_lineEdit.setText(str(Rheading) + u'\N{DEGREE SIGN}')

I'm sure this solves the issue

Please tell me if issue is resolved. You are my first external test ;)

Bye Aldo