jsbain / worldmap

Example of interfacing javascript with pythonista
6 stars 1 forks source link

Selecting a country that contains spaces fails #1

Open wradcliffe opened 9 years ago

wradcliffe commented 9 years ago

Selecting any country that has spaces in the name fails to return anything to the webview delegate. Most likely due to there being no code to uuencode the world: url.

jsbain commented 9 years ago

I cannot reproduce this. Which country did you select? What ios version, pythonista version are you using?

country selected: United States
country selected: Russian Federation
country selected: Australia
country selected: New Zealand
country selected: South Africa
country selected: Saudi Arabia
wradcliffe commented 9 years ago

Pythonista 1.6 - IOS 8.1.3 - "United States"

Must be something with 1.6

On Wednesday, February 18, 2015, jsbain notifications@github.com wrote:

I cannot reproduce this. Which country did you select? What ios version, pythonista version are you using?

country selected: United States country selected: Russian Federation country selected: Australia country selected: New Zealand country selected: South Africa country selected: Saudi Arabia

— Reply to this email directly or view it on GitHub https://github.com/jsbain/worldmap/issues/1#issuecomment-74993594.

jsbain commented 9 years ago

Does it work on other countries? I wonder if there is some kind of ios 8 security changes, or javascript changes. We could try creating more of a well formed uri, like

'world://show?argv=' + countryname

wradcliffe commented 9 years ago

Yes - it works fine for any country that has no spaces in the name. That's why I thought it was a URL encode problem. I was surprised that it works fine for you, but you are still on 1.5 - right?

On Thursday, February 19, 2015, jsbain notifications@github.com wrote:

Does it work on other countries? I wonder if there is some kind of ios 8 security changes, or javascript changes. We could try creating more of a well formed uri, like

'world://show?argv=' + countryname

— Reply to this email directly or view it on GitHub https://github.com/jsbain/worldmap/issues/1#issuecomment-75095821.

wradcliffe commented 9 years ago

Here is a fix to index.html that encodes the URL and turns the space to a %20:

window.location.assign('world://'+encodeURIComponent(worldmap.names[this.attr("title")]));

On Thursday, February 19, 2015, William Radcliffe bill.radcliffe@gmail.com wrote:

Yes - it works fine for any country that has no spaces in the name. That's why I thought it was a URL encode problem. I was surprised that it works fine for you, but you are still on 1.5 - right?

On Thursday, February 19, 2015, jsbain <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Does it work on other countries? I wonder if there is some kind of ios 8 security changes, or javascript changes. We could try creating more of a well formed uri, like

'world://show?argv=' + countryname

— Reply to this email directly or view it on GitHub https://github.com/jsbain/worldmap/issues/1#issuecomment-75095821.