How to insert HTML that includes an ampersand> I've created a custom block, and I'm trying to get this custom block to output a specific piece of HTML. The HTML needs to be different on every page, because it needs to include the page's URL in it. For instance, if the page is http://www.businesskorea.co.kr/article/7789/content-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor, then the block should output:

&lt;img src="http://cp.news.search.daum.net/api/publish.json?nurl={http%3A%2F%2Fwww.businesskorea.co.kr%2Farticle%2F7789%2Fcontent-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor}&amp;xml_url={http%3A%2F%2Fwww.businesskorea.co.kr%2Farticle%2F7789%2Fcontent-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor%3Fformat%3Dxml}&amp;channel=business" style="display:none;"&gt;


This is to be compatible with daum.net's news publishing functionality. The code that I've written up for this custom block looks like this:

&lt;?php

/**
* Implements hook_block_info().
*/

function bkcustom_block_info() {
  $blocks = array();
  $blocks['bkcustom_daum_json_block'] = array(
    'info' =&gt; t('BKCustom Daum JSON'),
  );
  return $blocks;
}

/**
* Implements hook_block_view().
*/

function bkcustom_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'bkcustom_daum_json_block':
      $block['subject'] = '';
      $block['content'] = BKCUSTOM_DAUM_JSON_BLOCK_CONTENT();
      break;
  }
  return $block;
}

function BKCUSTOM_DAUM_JSON_BLOCK_CONTENT() {
  $path_alias = drupal_get_path_alias($_GET["q"]);

  $encoded_path_alias = urlencode($path_alias);

  $output = t("&lt;img src=\"http://cp.news.search.daum.net/api/publish.json?nurl={http%3A%2F%2Fwww.businesskorea.co.kr%2F" . $encoded_path_alias . "}&amp;xml_url={http%3A%2F%2Fwww.businesskorea.co.kr%2F" . $encoded_path_alias . "%3Fformat%3Dxml}&amp;channel=business\" style=\"display:none;\" /&gt;");

  return $output;
}


Which outputs almost, but not quite, what I need. The output changes ampersands to &amp;amp;, and somehow deletes the final forward slash (/) at the end of the IMG tag. The output looks like this:

&lt;img src="http://cp.news.search.daum.net/api/publish.json?nurl={http%3A%2F%2Fwww.businesskorea.co.kr%2Farticle%2F7789%2Fcontent-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor}&amp;amp;xml_url={http%3A%2F%2Fwww.businesskorea.co.kr%2Farticle%2F7789%2Fcontent-business-marginalized-samsung-reorganizes-media-solution-center-owing-poor%3Fformat%3Dxml}&amp;amp;channel=business" style="display:none;"&gt;


The most frustrating part of this exercise is that if I delete the opening and closing brackets, &lt;>, the code works perfectly and prints out each character exactly as I need it to. That's how I tested to see if it would work. But when I introduce opening and closing brackets, the code changes and the JSON query or whatever the crap this is fails.

How can I preserve the &amp; and / characters?
t function is for texts, not for HTML, so it is perfectly allowed to fail. Also, you should not use dynamic strings in t's first argument at all, it is meant to be static. 

Whenever possible, you should use renderable arrays. In your specific case this seems a bit difficult, so first thing to, if you are willing to settle for quick and dirty, do would be just forget t and output tag directly.