Invalid UTF-8 from Autocomplete API

  • 1
  • Problem
  • Updated 3 years ago
The following auto-complete queries are returning invalid UTF-8, which makes my client blow up...

http://autocomplete.wunderground.com/aq?h=0&query=ibiz

Specifically the result contains this:
Pa�s Vasco, SPAIN

I've also seen: �, Denmark come back from a different query but I don't have logs for what the actual query was.

Is this API supposed to return UTF-8 or is it a different encoding?


I believe the first was supposed to be País Vasco, SPAIN.  The actual character coming back is 0xED, which corresponds to Windows codepage 1252 character í
Photo of Monscierge

Monscierge

  • 7 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
We will check that out.  That field is completed by the station own, and sometimes can have a strange character.  Its hard to trace back to which point it was encoded poorly.
Photo of Monscierge

Monscierge

  • 7 Posts
  • 0 Reply Likes
We coded up our service to fall back to 1252 when necessary but this error has cropped up again:

http://autocomplete.wunderground.com/aq?h=0&query=

With no query, the results contain:

Site_featureà##

The raw hex being sent is:

0x53, 0x69, 0x74, 0x65, 0x5F, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0xE0, 0x62, 0x31, 0x51

The problem is 0xE0, 0x62, 0x31, 0x51

It also contains:
Site_feature F ..
with hex
0x53, 0x69, 0x74, 0x65, 0x5F, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0xA0, 0x46, 0x1E, 0x0D

Again, the problem is 0xA0, 0x46, 0x1E, 0x0D



I have no idea what code page this data is, but it isn't UTF-8 nor 1252
Photo of Monscierge

Monscierge

  • 7 Posts
  • 0 Reply Likes
Further investigation shows that the data after "Site_feature" is pretty random, as if the string is missing a terminator.  I've seen the following:
Site_feature/beach:M!
Site_featureÓ
Site_featureÿÿÿÿski_!
Site_feature xc

Every time I hit it I get different data...
Photo of Tim Roche

Tim Roche, Official Rep

  • 322 Posts
  • 29 Reply Likes
Thanks for the info.

I've pushed this up the chain.