title: replace trademark symbol (™) when alone
body: <p>I'm trying to remove trademark symbol (™) but only in the case it's not followed by any other symbol for instance I might have â€™ which is a bad encoding of quotation mark (')  so I don't want to remove trademark symbol (™) and hence broking the pattern that i'm using to replace xx™ with quotation mark.</p>
  
  <pre><code>dict = {};
  
  chars = {
      '\xe2\x84\xa2': '', # ™
      '\xe2\x80\x99': "'", # â€™
          }
  
  def stats_change(char, number):
    if dict.has_key(char):
      dict[char] = dict[char]+number
    else:
      dict[char] = number # Add new entry
  
  def replace_chars(match):
    char = match.group(0)
    stats_change(char,1)
  
    return chars[char]
  
  i, nmatches = re.subn("(\\" + '|\\'.join(chars.keys()) + ")", replace_chars, i)
  count_matches += nmatches
  </code></pre>
  
  <p>Input: <code>foo™ oof</code><br>
  Output: <code>foo oof</code></p>
  
  <p>Input: <code>oâ€™f oof</code><br>
  Output: <code>o'f oof</code></p>
  
  <p>Any suggestions ?</p>