# Bad value X for attribute “data” on element “object”: Illegal character in path segment. Space is not allowed.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-data-on-element-object-illegal-character-in-path-segment-space-is-not-allowed
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The path in an `<object>` element's `data` attribute can't contain a literal space, so write each space as `%20` or rename the file so its URL has none.

The `data` attribute holds the URL of the resource the object embeds, often a PDF, and the URL Standard doesn't allow spaces in a path. The validator reports values like `/docs/annual report.pdf`, and one stray space is enough, as in `/docs/fees_ 2025.pdf`. Accented letters in a file name are allowed, so only the space needs fixing.

Browsers percent-encode the space when they request the file, so the embedded document usually still shows. The markup is invalid anyway, and a tool that reads the raw value may not encode it. A space after the `?` gives a different message, `Illegal character in query`, and `%20` fixes that one too.

When the object has a fallback link to the same file, the link's `href` gets its own `Illegal character in path segment` error. Change both values together.

## Invalid example

```html
<object data="/docs/annual report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual report.pdf">Download the annual report (PDF)</a></p>
</object>
```

## Valid example: space encoded as `%20`

```html
<object data="/docs/annual%20report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual%20report.pdf">Download the annual report (PDF)</a></p>
</object>
```

## Valid example: hyphen instead of a space

```html
<object data="/docs/annual-report.pdf" type="application/pdf" width="600" height="800">
  <p><a href="/docs/annual-report.pdf">Download the annual report (PDF)</a></p>
</object>
```
