Could you check with the Norwegian letters ÆØÅ? I tried with Tromsø and Trondheim. Seems like it does not collect information using these letters.

I'm Using it on http://drupal.no/ if anyone will see the module in use ;-)

Comments

tjodolv’s picture

Version: 6.x-1.5-beta1 » 6.x-1.5-beta2
Assigned: Unassigned » tjodolv
Status: Active » Needs review

Bugger.. 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 :)

Ole Martin’s picture

Uploaded 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

tjodolv’s picture

Status: Needs review » Fixed

Great :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vegardjo’s picture

Version: 6.x-1.5-beta2 » 6.x-2.2
Status: Closed (fixed) » Active
StatusFileSize
new130.81 KB

Hi, 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 :)

tjodolv’s picture

Tested 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?

vegardjo’s picture

Hi, 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!

tjodolv’s picture

That 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.

Anonymous’s picture

Status: Active » Needs review

DO 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ø/

tjodolv’s picture

What Kami says is true. I didn't think of that. Have you tried entering locations like he explains?

vegardjo’s picture

Hi, 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..

vegardjo’s picture

Status: Needs review » Closed (fixed)

Oh, 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 :)

tjodolv’s picture

Ok. By the way, what browser did you use?

vegardjo’s picture

I 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 get http://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.

tjodolv’s picture

Ok. 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 :)

Anonymous’s picture

Status: Closed (fixed) » Needs work

In _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));

tjodolv’s picture

Ok, I'll get to work on it later this week.

tjodolv’s picture

Status: Needs work » Needs review

Applied 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.

tjodolv’s picture

Version: 6.x-2.2 » 6.x-2.3
Status: Needs review » Fixed

Setting this as fixed in 6.x-2.3.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.