What to do when encoding is not declared

Some unintended consequences might arise after translating online digital content from one language to another. One problem that can occur is translated content that’s transmitted to a different medium. When copied from one file to another, simple sentences containing accented characters or special formatting may appear deformed. 

When this happens particular characters and parts of punctuation will be displayed as a string of question marks or a random assortment of non-standard characters. That’s why character encoding is essential when it comes to accurately rendering text on a localized website.

In this article, we’ll discuss what character encoding is, why it is important, and what to do when the error message “encoding was not declared” appears. 

What is meant by the term “character encoding”?

Character encoding instructs computers on how to read and understand text, numbers, and special symbols contained in digital data. To do this, a unique numerical value is associated with each letter, number, and symbol in the alphabet. The numerical value is called a “code point,” which is stored in a character set or repertoire for the character. The code point is a series of ones and zeroes that are saved as bytes with the respective characters. 

Character encoding translates the characters you type into their corresponding code point in the computer’s memory. As a result, the computer can correctly render the typed characters. The computer will not be able to interpret the characters and show the correct data without the proper encoding. 

Importance of character encoding format

Each character set possesses its own one-of-a-kind table of identification codes that it employs to present a particular character to a user. When going from one character set to the other the correct encoding is needed so everything displays correctly. 

Here’s a quick example. If you were editing a document with the ISO-8859-1 character set and then saving that document as a UTF-8 encoded document without specifying that the content was UTF-8, special characters and company symbols will not be accessible in the saved document.

Most contemporary web browsers accept legacy character encodings so that a website can incorporate pages encoded in ISO-8859-1, Windows-1252, or any other encoding. If the server reports the character encoding format, the browser should correctly render those characters. However, suppose the character set is not appropriately stated when the page is generated. In that case, the web server renders information without a particular character encoding format specified.

How to fix “encoding not declared” issues

Use a meta element with a charset attribute to specify the encoding of your HTML document. 

If you’re using WordPress:

  • Go to your dashboard
  • Choose “Appearance”
  • Then select “Theme Editor” to locate the relevant header.php file.
  • Insert a meta element on the charset line that comes immediately after the head tag. Unicode version 8 (UTF-8) should be used, and all text should be saved in this format. The line will look like this in practice: meta charset=” UTF-8″>.

Keep in mind that an unmappable character could cause an error. An unmappable character is a character that does not conform to the UTF-8 standard. You can fix the issue by opening the file in a UTF-8 compatible editor, finding the broken character, and saving the file again.

Taking the steps above should correct any undeclared encoding issues. Just keep in mind that the error could come up again, so regular monitoring is suggested.

Categories:

Start using evisio today at no cost.

Complete access without commitment.

Try evisio FREE for 7 Days

What evisio is all about

Evisio helps agencies, marketers, and SEO consultants get results, no matter their level of SEO knowledge. It takes the guesswork out of SEO by telling you exactly what to do to improve your rankings and makes SEO simple by bringing all the parts of your SEO process together in one place.