FieldStudiesCouncil / QGIS-Biological-Recording-Tools

QGIS plugin for biological recorders. Created with the FSC Tomorrow's Biodiversity project.
GNU General Public License v3.0
10 stars 4 forks source link

Non standard whitespace characters around GR cause python error #48

Closed burkmarr closed 3 years ago

burkmarr commented 3 years ago

The Biological Records tool trims off whitespace characters from a grid reference before using it. But some non-standard whitespace characters are not trimmed, causing a python error when the GR is processed.

A workaround is to trim these out of the GRs using Excel. The standard 'TRIM' function won't recognise them, but you can use this insread: =TRIM(SUBSTITUTE(A2,CHAR(160),CHAR(32)))

charlesroper commented 3 years ago

Can you provide an example of some data with these non-standard characters in, @burkmarr? This is a case we'll need to handle for the Atlas work we're doing for BioLinks.

Cc @andrewmfsc

burkmarr commented 3 years ago

I think they will be preserved if you copy from below @charlesroper. (In fact the problem reported to me turned out to be mostly trailing characters rather than leading characters):

gridref
NM984572 
NM665692  
NM665692  
NM665692  
NM665692  
NM665692  
NM665692  
NM665692  
NM665692  
 NN746986
burkmarr commented 3 years ago

Used some code to remove all non-printabel characters.