0

I have a string which contain several special characters. Most of them seem to change to the correct characters, however there is 2 which does not seem to want to change. How come that?

Here is a example how the string looks like

I’m looking to create a team, but we’re still in the discussion phase 
with the players and the organisations, and nothing is certain.
” In addition, Maikel "Maikelele" Bill added the following: “

code:

extension String {
   init(htmlEncodedString: String) {
    let encodedData = htmlEncodedString.dataUsingEncoding(NSUTF8StringEncoding)!
    let attributedOptions = [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType]
    let attributedString = NSAttributedString(data: encodedData, options: attributedOptions, documentAttributes: nil, error: nil)
    self.init(attributedString!.string)
    }
}

viewDidLoad:

var testString = "I’m looking to create a team, but we’re still in the discussion phase with the players and the organisations, and nothing is certain. ” In addition, Maikel \"Maikelele\" Bill added the following: “"

println(String(testString))
Peter Pik
  • 11,023
  • 19
  • 84
  • 142

0 Answers0