In 8.6 Converting a URL string to an AppLink I’m confused about encoding and decoding … The text says
- First, you need to decode the URL. URLs often include special characters in their paths, so you need to percent-encode the URL path. For example, you’d encode
and the code says // 1
location = Uri.decodeFull(location ?? ‘’);
This is super confusing … or maybe something is wrong in either the text or the code. AT this point, are we trying to encode or decode?
@jefff9511 thanks and really appreciate your feedback. Definitely could improve the explanation here.
fromLocation takes a url string / path and decodes it. Typically with web url links, paths may have been encoded. Encoded string may look something like this:
This is especially useful for other languages, like Chinese. When you decode the string above it gives you this:
More example here:
URL Encoding | Google Maps Platform | Google Developers.
toLocation takes the current navigation state and generates an encoded url path.
Hope this helps!