rochaporto / ezgliding

Website and software for analyzing, visualizing and planning gliding flights
GNU General Public License v3.0
5 stars 2 forks source link

support for accents in netcoupe #88

Closed rochaporto closed 9 years ago

rochaporto commented 9 years ago

Example of netcoupe.net parsing failure (Name, Category, Club, Region).

Happening when name/club/region/etc have accents.

./ezgliding flight-get -id=666
09/03/2015,PRAT Helene,Arcus M,D-KRHP
    netcoupe: {SourceID: Name: Category: Club: Region: Country:France Date:2015-03-09 00:00:00 +0000 UTC Takeoff:Saint Gaudens Distance:471.67 Points:328.12 Type: CircuitType:Libre Speed:98.61 Start: Turnpoints:[{Time:0001-01-01 00:00:00 +0000 UTC Latitude:0 Longitude:0 FixValidity:0 PressureAltitude:0 GNSSAltitude:0 IData:map[] NumSatellites:0 Description:} {Time:0001-01-01 00:00:00 +0000 UTC Latitude:0 Longitude:0 FixValidity:0 PressureAltitude:0 GNSSAltitude:0 IData:map[] NumSatellites:0 Description:} {Time:0001-01-01 00:00:00 +0000 UTC Latitude:0 Longitude:0 FixValidity:0 PressureAltitude:0 GNSSAltitude:0 IData:map[] NumSatellites:0 Description:}] Finish: Comment:Petite onde de Nord Est DownloadURL:/Download/DownloadIGC.aspx?FileID=930}
rochaporto commented 9 years ago

export LANG="fr_FR.ISO-8859" (or setting encoding in the terminal window):

./ezgliding flight-get -id 666
09/03/2015,PRAT Helene,Arcus M,D-KRHP
    netcoupe,Hélène PRAT,+ de 25 ans,A. vélivole Commingeoise,France,Midi-Pyrénées,471.67,328.12
rochaporto commented 9 years ago

Using a local file instead of url, changing the encoding also works:

iconv -f ISO-8859-1 -t UTF-8 t/Results/FlightDetail.aspx\?FlightID\=2 > t/Results/FlightDetail.aspx\?FlightID\=2a
mv t/Results/FlightDetail.aspx\?FlightID\=2a t/Results/FlightDetail.aspx\?FlightID\=2
rochaporto commented 9 years ago

Need to find out how to force encoding to ISO-8859 in this case in golang: http://blog.golang.org/strings

rochaporto commented 9 years ago

Some more help: http://stackoverflow.com/questions/24555819/golang-persist-using-iso-8859-1-charset