Trying to convert string looking like "ÐавлÑк ÐÑкÑоÑ" to correctly looking string



I've got a problem converting string looking like "ÐавлÑк ÐÑкÑоÑ" to correctly looking string.

I'm trying to use such way:

func stringToUTF16String (stringaDaConvertire stringa:
String) -> String {

        let encodedData =
stringa.dataUsingEncoding(NSUTF16StringEncoding)!
        let attributedOptions = [NSDocumentTypeDocumentAttribute:
NSHTMLTextDocumentType]
       let attributedString = NSAttributedString(data: encodedData,
options: attributedOptions, documentAttributes: nil, error: nil)!


        //println(attributedString.string)
        return attributedString.string
    }

But I got a compiler error: "Type of expression is ambisious withou more context" on that row:

 let attributedString = NSAttributedString(data:
encodedData, options: attributedOptions, documentAttributes: nil,
error: nil)!

Related to : Trying to convert string looking like "ÐавлÑк ÐÑкÑоÑ" to correctly looking string

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .