RankDossier
Check family

Character encoding and development URLs in metadata: basic page errors

Some errors are small but affect every page. These checks look for a character encoding that is not declared, a conflict between the encoding in the HTTP header and in the HTML, and development addresses, such as localhost or a test host, left in metadata like canonical or Open Graph tags. Declare UTF-8 once and use only live addresses in tags.

How the problem happens

The server sends one charset while the template declares another, or none at all. A development address is hard-coded into the metadata and ships to production because the code works locally.

Why basic page errors cost rankings and trust

These are small errors, but they sit in the foundation and they repeat on every page that uses the same template. A character encoding tells the browser and the crawler how to turn bytes into letters. If it is not declared, or if the HTTP header says one thing and the HTML says another, the reader has to guess. For plain English text the guess usually works. For accents, the Cyrillic alphabet, German umlauts or an en dash in a title, a wrong guess shows garbled characters, and that can happen in the title and description that appear in search results.

Development addresses in metadata are a different kind of leak. A canonical tag that points to a localhost or a staging host tells search engines that the real version of the page lives somewhere they cannot reach or must not index, and the live page can drop out of results. An Open Graph URL or image that points to a test server can make a shared link show a broken or wrong preview. Because the code worked on the developer's machine, nobody notices until the site is live. The damage is wide, since the same template error repeats across the whole site.

How to check encoding and development URLs by hand

For encoding, look at both places where it is declared. Request the page headers and read the content type, which should name the charset, then view the source and find the meta charset tag. They must name the same encoding, and the tag should appear very early in the head, within the first 1024 bytes, before any text, so that the browser sees it before it starts decoding. Then look at the page itself: scan titles, headings and body text for strange characters, question marks in diamonds, or sequences of accented letters that look like gibberish.

For development addresses, open the source of a live page and search for localhost, a local test address, words such as staging, development or test in a host name and top-level domains used only for development. Check the places that matter most: the canonical link, the Open Graph URL and image, the alternate language links, structured data, the sitemap and any absolute links. Do it for several templates, such as the home page, an article, a product and a category, because the error often lives in a single template or in a configuration value that every template reads.

# What the server says about the encoding
curl -s -I https://example.com/ | grep -i content-type
# content-type: text/html; charset=utf-8

<!-- The HTML must agree, and sit in the first 1024 bytes -->
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>…</title>

# Find development addresses that leaked into the live HTML
curl -s https://example.com/ | grep -o -i -E "(localhost|127\.0\.0\.1|staging[^\"' ]*|[a-z0-9-]+\.(local|test|dev))[^\"' ]*"

# nginx
charset utf-8;
charset_types text/html text/plain text/css application/javascript application/json;

How to fix encoding and development URLs in code and on the server

Choose UTF-8 and use it everywhere: files saved as UTF-8, the database and its connection set to UTF-8, the HTTP header naming it, and one meta charset tag as the first element in the head. Remove a second declaration added by a theme, a plugin or a template include, because two different statements are the cause of a conflict. At the server, send the charset in the content type for text responses, as in the example. Do not rely on the browser to detect the encoding.

For development addresses, stop hard-coding hosts. Build every absolute address from a single setting that holds the live site address, set from the environment, and make the build fail or warn when the value looks like a local or test host. Review the configuration of the SEO plugin or the framework metadata for leftover test addresses, and search the code and the content for old staging domains after copying a site. When a site moves from a test environment to production, regenerate the sitemap and the cached pages. Where a development copy must stay online, keep it behind a login so that it is never crawled, rather than relying on it staying orphaned.

How RankDossier detects basic page errors

RankDossier compares what the server sends with what the document says. There are three checks in this family. One reports that the character encoding is not declared at all. A second reports a conflict, where the Content-Type header and the meta charset tag name different character sets, which can make browsers show garbled text. A third reports development addresses in metadata, where the canonical, the Open Graph URL or other tags point to localhost, a staging host or a development host.

Because all three reflect a template or a server setting, one fix usually clears every page that shares it. After a fix, share a link and look at it with the Open Graph checker to confirm the address in the tags. The technical SEO audit guide places these basics among the other signals, the site migration SEO guide explains how test addresses leak during a move, and the canonical, noindex and multilingual guide covers the tags that most often carry a wrong address.

Wrong and right

Wrong

<head>
  <title>Example</title>
  <!-- no charset declared; the canonical still points to the local development server -->
  <link rel="canonical" href="http://your-dev-server/pricing">
</head>
<head>
  <meta charset="utf-8">
  <title>Example</title>
  <link rel="canonical" href="https://example.com/pricing">
</head>

How to fix it

WordPress

Keep the site and database in UTF-8, remove a second charset declaration added by a theme or plugin, and search the settings of your SEO plugin for test addresses.

Next.js

Next.js declares UTF-8 by itself. Set metadataBase from an environment variable that holds the live address, so relative tags resolve to the live address instead of localhost.

// app/layout.tsx: Next.js writes <meta charset="utf-8"> by itself
export const metadata = { metadataBase: new URL('https://example.com') };

Nginx

Set charset utf-8 in the server block so that the Content-Type header names the encoding, and make sure it matches the meta tag in the HTML.

charset utf-8;
default_type text/html;
# check: curl -s -I https://example.com/ | grep -i content-type

Check codes in this family

These checks belong to this family. Each code appears in the audit report with its own explanation and fix.

  • CHARSET_MISSING Character encoding not declared
  • DEV_URL_IN_META Development URLs in metadata
  • CHARSET_CONFLICT Conflicting character encoding

Read the full guide How to run a technical SEO audit and prioritize the fixes for the wider picture.

Check your own site

Enter a domain – the free pre-check reads up to 10 pages and shows how many types of problems it finds. You pay only if you want the full report.

Start the free pre-check