Closed (fixed)
Project:
Yr Weatherdata
Version:
6.x-2.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 Sep 2009 at 14:24 UTC
Updated:
6 Nov 2011 at 14:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tjodolv commentedBugger.. Seems like I actually forgot to urlencode the location name before it's sent to yr.no.
New beta released, tested locally and on a remote host. Please report any further issues :)
Comment #2
Ole Martin commentedUploaded new release, and now we can see Tromsø, and it rains there just now ;-).
Terrific, not that it rains in Tromsø, but that you upgrade it so quickly
Comment #3
tjodolv commentedGreat :)
Comment #5
vegardjo commentedHi, still getting this bug for all locations that includes æøå in the URL. I get this error message:
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "sites/default/files/yr_verdata/b3f7403b02b69e99836b6e944b73ddc4.xml" in yr_verdata_generate() (line 423 of /Applications/MAMP/htdocs/sp/sites/all/modules/contrib/yr_verdata/yr_verdata.module).
Locations without æøå in the URL works just fine, see screenshot :)
Comment #6
tjodolv commentedTested this tonight, but I cannot reproduce the bug. I need more information about your environment to solve this.
Are you using the latest version? Did you do a fresh install or upgrade? What version did you upgrade from? Have you cleared the caches?
Comment #7
vegardjo commentedHi, thanks for the quick response! I'm using a clean install of the 2.2 version. The setup is Pressflow on localhost (MAMP, php 5.2.5) , with only the usual suspects of modules enabled. Caches have been cleared.
I get the same result if I add a false URL to locations, so it seems to me it can't read the URLs if they include æøå. Here's a couple screenshots more, one of a location that doesn't work, and one of the source code for the same.
Let me know what more you might need!
Comment #8
tjodolv commentedThat is strange. I'll try to figure this out as soon as I have time. I do have two exams next week, so I may not be able to get it done until after that.
Comment #9
Anonymous (not verified) commentedDO NOT enter the URL-encoded URL into the URL field like this:
http://www.yr.no/sted/Norge/Troms/Troms%C3%B8/Troms%C3%B8/
(this is utf, latin-1 won't work any better)
DO enter the url like this:
http://www.yr.no/sted/Norge/Troms/Tromsø/Tromsø/
Comment #10
tjodolv commentedWhat Kami says is true. I didn't think of that. Have you tried entering locations like he explains?
Comment #11
vegardjo commentedHi, I just pasted it in from the URL, which was http://www.yr.no/sted/Norge/Troms/Tromsø/Tromsø/ - the encoding you see in the view source screenshot wasn't done by me..
Comment #12
vegardjo commentedOh, found it!
Kami was right. When I cut and paste the URL field the browser encodes æøå automatically. I solved this by manually typing in the URL instead - thanks :)
Comment #13
tjodolv commentedOk. By the way, what browser did you use?
Comment #14
vegardjo commentedI used Chrome for Mac, and also tested with Firefox for Mac. Tested some more today and this is what I find:
If you copy
http://www.yr.no/sted/Norge/Oppland/Øyer/(or anything with øæå) from the adress field in Chrome or Firefox you gethttp://www.yr.no/sted/Norge/Oppland/%C3%98yer/in the text input field, while if you copy the same from the adress field in Safari or Opera it will be correct. So it's actually a matter of which browser you copy the URL field from. Haven't tested on other operating systems.Comment #15
tjodolv commentedOk. I'll see if I can create a workaround for this, or at least make a note in README.txt about it. Thanks for letting me know :)
Comment #16
Anonymous (not verified) commentedIn _yr_verdata_fetch_xml() in yr_verdata.module you are drupal_urlencode()-ing the url, which in this case is already url-encoded, resulting in the original "%" being replaced with "%25".
$feed = check_url('http://www.yr.no/' . drupal_urlencode(drupal_substr($location->url, 17)) . 'varsel.xml');Maybe you'd want to rawurldecode() before that:
$feed = check_url('http://www.yr.no/' . drupal_urlencode(drupal_substr(rawurldecode($location->url), 17)) . 'varsel.xml');And similar in yr_verdata.admin.inc:
$components = explode('/', drupal_substr(rawurldecode($url), 17, -1));Comment #17
tjodolv commentedOk, I'll get to work on it later this week.
Comment #18
tjodolv commentedApplied the fix described by Kami Petersen today, and it seems to be working for me, both in browsers that does the urlencoding as well as browsers that do not. Should show up in dev tonight.
Comment #19
tjodolv commentedSetting this as fixed in 6.x-2.3.