Closed naiyyar closed 7 years ago
You might want to pull the code out of the attributed_html
method and play with the encoding and options to see if you can fix it. Unfortunately I can't compile sugarcube at the moment, so I can't reproduce this.
I just want the same output when using attributed_html on it as it is in json. I don't know why attributed_html is not encoding french characters properly as you can see above code block before applying attibuted_html string is Développer and after Développer.
Thanks @colinta Solved by using below code
class NSString
def attributed_html
options = { NSDocumentTypeDocumentAttribute => NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute => NSUTF8StringEncoding }
#options = { NSDocumentTypeDocumentAttribute => NSHTMLTextDocumentType}
NSAttributedString.alloc.initWithData(self.dataUsingEncoding(NSUTF8StringEncoding), options:options, documentAttributes:nil, error:nil)
end
end
Awesome! Please consider creating a pull request and adding this fix to sugarcube! 😃
I'm disappointed that you found the fix but then didn't open a pull request. That's how we make software better! I'll include this in a patch release version.
Hi,
This my json string "
Développer nouveau site
".OUTPUT IS: "Développer nouveau site\n"
How can i get the output string in readable format?