Invalid byte 1 Error

select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=boston"

When I execute the query above via ajax or the YQL Console, I receive this error in the diagnostics:

url error="Invalid byte 1 of 1-byte UTF-8 sequence."

However, if I open this URL in a browser:


I get a well formed XML document. Any idea what could be going wrong here?!

BTW, these queries all execute without error:

select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=boston1"
select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=1boston"
select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=oston"
select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=london"
select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=dallas"

3 Replies
  • An update:

    These queries work:

    select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=b"
    select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=bo"
    select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=bos"
    select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=bost"

    But this one fails:

    select * from xml where url="http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=bosto"
  • Looks like they have invalid unicode in their API:

    strikeweek-dm:~ samp$ curl "http://www.accuweather.com/includes/ajax-functions/cityLookup.asp?location=boston" | xmllint --format -
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 2250 100 2250 0 0 755 0 0:00:02 0:00:02 --:--:-- 1186
    -:19: parser error : Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFC 0x65 0x79 0x29
    <location city="Boston" state="Cuba (Camag?ey)" location="CAC|CU|CU001|Boston"/
  • Thank you Sam! Never used xmllint before, but it certainly identifies the problem quickly.

Recent Posts

in YQL