Copy link to clipboard
Copied
Hi..
I am trying to open a Google Maps URL from 4 filled variables via a form in Acrobat.
I am using this Javascript code:
var Adresse = getField("Adresse").value;
var Nr = getField("Nr").value;
var Postnr = getField("Postnr").value;
var By = getField("By").value;
var myURL = "http://www.google.dk/maps/place/"+Adresse+"+"+Nr+"+"+Postnr+"+"+By;
app.launchURL(myURL, true);
But when having ”æ”, ”ø” and ”å” in the variables, the output URL is not correct. This is my output:
https://www.google.dk/maps/place/H%E6vlingeb%E5nken+17+4681+Herf%F8lge
when typing these variables:

So I need somehow to encode the URL to ISO-8859...or other encoding? so the characters "æ", "ø" and "å" are used correctly...
Is that possible?
Also, you don't need a function for this, just add this line before the launchURL command:
myURL = encodeURI(myURL);
Copy link to clipboard
Copied
Try JS's global encodeURI method.
Copy link to clipboard
Copied
Hi try67
Thanks for your reply. I am not a skilled coder, just a graphic designer trying my best to make things work ![]()
So I am not sure how to use that method correctly...
From what I can read about the method on that page, I have inserted it like this, but I get a SyntaxError from Acrobat...

Any help writing the exact code is VERY appreciated
Copy link to clipboard
Copied
Remove all of the "replace" commands you added. They should not be necessary after the encodeURI command.
Copy link to clipboard
Copied
Also, you don't need a function for this, just add this line before the launchURL command:
myURL = encodeURI(myURL);
Copy link to clipboard
Copied
YOU ARE A STAR..!!!!!
Thank you so much..
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more