Hello,

I am seeing this in both 1.2 and dev snapshot:

  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My Site title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
CommentFileSizeAuthor
#9 601264_duplicate_utf8_charset.patch816 bytesmatason

Comments

avpaderno’s picture

Category: bug » support

I see it too, but that is not caused by Nodewords. That meta tag is supposed to be returned from drupal_get_html_head(), but it seems some module is adding it through drupal_set_html_head().
If it is perfectly legitimate to add such meta tag through drupal_set_html_head(), why is drupal_get_html_head() adding it to the output it returns? It should at least check if the meta tag has been already added, at least; differently, it is going to return a duplicated meta tag, as it is happening.

function drupal_get_html_head() {
  $output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
  return $output . drupal_set_html_head();
}
avpaderno’s picture

To notice that the problem is also present in Drupal.org, which is not using Nodewords.

For this page, I get the following HTML output:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <!-- Note: does not validate. We would like it to, but that would mean reduced user experience for the majority of our visitors. -->
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
  <title>meta charset duplicated output | drupal.org</title>
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/codefilter/codefilter.css?8" />
<link type="text/css" rel="stylesheet" media="all" href="/files/css/css_e152b8a2aa86d5d96589370b29d7991a.css" />
<link type="text/css" rel="stylesheet" media="print" href="/files/css/css_131f0cf18029564f8d026691328015b7.css" />
  <script type="text/javascript" src="/files/js/js_fd2a3f0c3c9484074942c159676c54c2.js"></script>
<script type="text/javascript">
avpaderno’s picture

I created a report for Drupal (see #601376: Duplicated "Content-type" tag is present in each pages).

I have already noted that when I was testing Nodewords, and I forgot to make a report. Thanks for reminding me of this.

giorgio79’s picture

Lol , thanks Kiam. :) I have not noticed even drupal.org has this :)

avpaderno’s picture

Title: meta charset duplicated output » Meta Content-Type appears twice

I am correcting the title, as the meta tag that appears twice is the Content-Type one.

avpaderno’s picture

Category: support » task
Status: Active » Fixed

Although the problem is not caused by Nodewords, I added the code to remove any duplicated meta Content-Type it finds.

Maybe I will add an option to enable that code, and a checking on the Drupal version (in the case the problem is fixed in Drupal core).

hass’s picture

Put this hereby on my testing list for the reason that this may re-introducing a core security bug.

avpaderno’s picture

It's rather impossible, as the code remove duplicated meta Content-Type, which means there is always that meta tag. The change made on core module is to be sure there is always that meta tag, and the module is not removing all the occurrences of the meta tag.

matason’s picture

Project: Nodewords: D6 Meta Tags » Drupal core
Version: 6.x-1.x-dev » 6.14
Component: Code » markup
Category: task » bug
Priority: Normal » Minor
Status: Fixed » Needs review
StatusFileSize
new816 bytes

This duplication is caused by code in common.inc, the charset is added in the function drupal_get_html_head() and then it's inserted again (rather inefficiently) to make sure it's the first thing in head in the function drupal_final_markup()

I've attached a patch which adds to the inefficiency(!) but deals with the duplication. This is not really the place to be doing this, it's too late in the page build process, I'll have a more detailed look this evening and see if there's a better solution.

I've also had a quick look at Drupal 7 and it looks like drupal_final_markup() has gone.

This is also a pretty minor issue(?) that doesn't merit fixing? Does having duplicate charset meta cause any issues?

hass’s picture

Project: Drupal core » Nodewords: D6 Meta Tags
Version: 6.14 » 6.x-1.x-dev
Component: markup » Code
Category: bug » task
Status: Needs review » Fixed
matason’s picture

Project: Nodewords: D6 Meta Tags » Drupal core
Version: 6.x-1.x-dev » 6.14
Component: Code » markup
Category: task » bug
Status: Fixed » Closed (duplicate)

Doh, I should have done a bit of clicking...

This looks like the issue - http://drupal.org/node/451304

Marking this as duplicate.

hass’s picture

Project: Drupal core » Nodewords: D6 Meta Tags
Version: 6.14 » 6.x-1.x-dev
Component: markup » Code
Category: bug » task
Status: Closed (duplicate) » Fixed

Please keep the issue as is.

avpaderno’s picture

Category: task » support

I removed the code I added, as the call to drupal_final_markup() is made after the call to nodewords_preprocess_page(); therefore, the code is perfectly useless.

I am changing back the category.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.