Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

449
Views
How to include %20 spaces in Google QR code URL after scanning?

I'm trying to generate QR code images that contain Google Maps routes. For example, I have the following Google Maps URL:

$encodedmapsurl = https://www.google.nl/maps/dir/De%20Aar%2018,%208253%20PN%20Dronten/De%20Lepelaar%2012,%208251MT%20Dronten/De%20Lepelaar%201,%208251mt%20Dronten/De%20Aar%2018,%208253%20PN%20Dronten/

And I generate the Google Charts QR code like this:

<img src="https://api.qrserver.com/v1/create-qr-code/?data=$encodedmapsurl&amp;size=150x150" />

I end up with the following QR code:

enter image description here

This is fine, however, when I scan the QR code with a mobile application, the result is:

enter image description here

Notice that the URL itself contains %20 for every space in the URL, but the result (after scanning the QR code) does not. This results in an unclickable URL. This behaviour is weird considering some QR code generators do include the %20 in the URL after scanning, such as this one. Is there any way with the Google Charts QR code API to include the %20's in the URL after scanning it? Alternatively I'm also fine with using another PHP library/API that does the job (I couldn't find one). The result should look like this:

enter image description here

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Try formally encoding it as a url first:

$encodedmapsurl = "https://www.google.nl/maps/dir/De%20Aar%2018,%208253%20PN%20Dronten/De%20Lepelaar%2012,%208251MT%20Dronten/De%20Lepelaar%201,%208251mt%20Dronten/De%20Aar%2018,%208253%20PN%20Dronten/";
$encodedmapsurl = urlencode($encodedmapsurl);

Also, then try also then sending the encoded url to bitly or similar shortener before generating the qr code.

If that still doesn't work, being in Japan I often find special characters leading to many hard-to-find/fix issues (e.g. a 1-bit "%" vs a 2-bit "%" character). Try using the charset-source (and charset-target) parameter.

over 4 years ago · Santiago Trujillo Report

0

Only encode once:

$map_url = 'https://www.google.nl/maps/dir/De+Aar+18,+8253+PN+Dronten,+Netherlands/De+Lepelaar+12,+8251+MT+Dronten,+Netherlands/De+Lepelaar+1,+8251+MT+Dronten,+Netherlands/De+Aar+18,+8253+PN+Dronten,+Netherlands/@52.5308376,5.7062268,14z/data=!3m1!4b1!4m25!4m24!1m5!1m1!1s0x47c62a8ab5ae23a5:0x44f1928143db42a1!2m2!1d5.7085273!2d52.5441879!1m5!1m1!1s0x47c62b202ae17a0f:0x1abd001f5225a013!2m2!1d5.7290961!2d52.5190013!1m5!1m1!1s0x47c62b202fc55b65:0x12f835f420fa2676!2m2!1d5.7298615!2d52.5194267!1m5!1m1!1s0x47c62a8ab5ae23a5:0x44f1928143db42a1!2m2!1d5.7085273!2d52.5441879';
$encoded_url = urlencode( $map_url );
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!