Skip to main content
HTML Validation

Bad value X for attribute “href” on element “a”: Illegal character in path segment. “�” is not allowed.

About This HTML Issue

The href value on the <a> element contains � (U+FFFD, the Unicode replacement character), which the validator doesn't allow in a URL path.

A text decoder puts � in place of bytes that don't make a valid character in the encoding it's reading. In a URL, it marks where the original character, often a letter with an accent such as é, got lost. Browsers send it as %EF%BF%BD, so the link most likely leads to a page that doesn't exist.

Most of the time the page's encoding is to blame. With no <meta charset> in the document and no charset from the server, the validator falls back to windows-1252 and reads UTF-8 bytes as the wrong characters. The reverse mismatch is a page that declares utf-8 while the file is saved as windows-1252, where a byte such as 0xE9 (é) isn't valid UTF-8.

Either way, each byte that can't be decoded becomes �, and the report also shows "Malformed byte sequence" or "Unmappable byte sequence" errors. Leftover letters like à or  next to the � in the reported value point the same way. Save the file as UTF-8 and declare it with <meta charset="utf-8"> at the top of <head>, which also fixes any other garbled text on the page.

When the encoding is already right and the error doesn't go away, the � is in the source itself. The character was lost earlier, for example during an import into a CMS, and saved as �, so no encoding setting can bring it back. Write the intended character, percent-encode it (é is %C3%A9), or use an ASCII-only slug.

Invalid example

<a href="/menu/caf�-specials.html">Café specials</a>

Valid example

Save the file as UTF-8, declare the encoding and write the intended character:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Menu</title>
</head>
<body>
  <a href="/menu/café-specials.html">Café specials</a>
</body>
</html>

To keep the URL ASCII-only, percent-encode the character instead:

<a href="/menu/caf%C3%A9-specials.html">Café specials</a>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries