title: In Swift NSAttributedString has more characters than String?
body: <p>I am trying to add attributes to some ranges in Swift String.
  I found ranges of first and last symbol in substring and color the text between them (including) in red.</p>
  
  <pre><code>let mutableString = NSMutableAttributedString(string: text)
  let str = mutableString.string
  //Red symbols
  var t = 0
  let symbols = mutableString.string.characters.count
  while t &lt; symbols {
      if str[t] == "[" {
      let startIndex = t
      while str[t] != "]" {
          t += 1
      }
      t += 1
      let endIndex = t
  
      mutableString.addAttribute(
          NSForegroundColorAttributeName,                    
          value: UIColor.redColor(),   
          range: NSMakeRange(startIndex, endIndex - startIndex))
      }
      t += 1
  }
  </code></pre>
  
  <p>But I found that ranges in String and in NSMutableAttributedString are not equal. Range in String is shorter (this text is not in Unicode encoding). 
  Is there a some way to find ranges not in underlying String but in NSAttributedString to find it correctly?</p>
  
  <p>Example:</p>
  
  <pre><code>print(mutableString.length) //550
  print(mutableString.string.characters.count) //548
  </code></pre>
  
  <p>Why is this difference?</p>