Encoding URLs is one of the most critical phases of web designing and development, as it allows characters to be transmitted to the internet. Since a URL is a web page address, it’s best to know what troubles you may encounter with characters, such as whitespaces. You can check out a video of Google Webmaster Central office-hours hangout with talking about issues like this.
If you want to find out what Google has to say about using spaces in your URL, you can read through this article.
When developing websites or specific pages of your site, be careful not to insert invalid characters. This applies to your URL as well. For this to happen, you need to start learning about some of the characters. In this article, we’ll focus on whitespaces.
What Does the “URL Whitespace Character” Error Mean?
In programming terms, whitespace is any character or set representing a horizontal or vertical space. When rendered, it’s not visible, but it takes up space on the page. Standard whitespace is placed in a URL instead of putting a common space in between the other characters.
Take note that whitespace characters vary among computer languages. Whitespace used in HTML is different from that in CSS.
What Triggers This Issue?
URL encoding simply doesn’t allow spaces. A space is considered unsafe and makes a URL invalid. That’s why whitespace is used instead. In URLs and even with document directories, a document that contains whitespace in their paths or names is usually used. But unlike in URLs, spaces in instances like this will automatically be encoded and result in whitespace.
How To Check the Issue
You can use various tools or test methods to check for whitespaces in strings or URLs — for example, RegEx. However, this requires coding skills since you’ll have to generate a working function or code to detect whitespace. These methods can check for characters like spaces, tabs, form feeds, and carriage returns.
For checking whitespaces in actual URLs, you can simply observe if there are characters in the path. Whitespace can be represented by + and %20 (not 20%.)
Find out not only the information about URL contains whitespace, but also the presence of technical errors on it!
Conduct a full audit to find out and fix all the site level and page level issues on your website.
Why Is This Important?
Yes, it is indeed important. Although they’re used to encode and represent spaces, they’re not recommended because they can cause issues when site users link to the URL or share it.
Moreover, these characters in URLs and addresses are considered unsafe. Although they make links readable, they’re risky in terms of SEO. Having whitespace can possibly lead to a broken link and loss of potential link equity.
How To Fix the Issue
The best way to resolve this issue is to have no spaces at all. Remove them and use allowed characters only — for instance, a hyphen or encode using + and %20 in the query-string and %20 within the rest of the URL.