I have a UIWebView and I want that it shows a .txt file. All works fine but in germany we have some special characters like ä,ö,ü and those won't be show... I need so encode this txt-file with UTF8 but I don't know how..?
I have a UIWebView and I want that it shows a .txt file. All works fine but in germany we have some special characters like ä,ö,ü and those won't be show... I need so encode this txt-file with UTF8 but I don't know how..?
i suggest either you add a doctype to your text as an html page, and you specifies the UTF-8 format, or you could load the content of your file in a NSData object, then load the content with
[webView loadHtmlString...withBaseURL]
and in this method, when you make the NSString with the NSData, you specifie the UTF-8 encoding.
i suggest either you add a doctype to your text as an html page, and you specifies the UTF-8 format, or you could load the content of your file in a NSData object, then load the content with
[webView loadHtmlString...withBaseURL]
and in this method, when you make the NSString with the NSData, you specifie the UTF-8 encoding.
i suggest either you add a doctype to your text as an html page, and you specifies the UTF-8 format, or you could load the content of your file in a NSData object, then load the content with
[webView loadHtmlString...withBaseURL]
and in this method, when you make the NSString with the NSData, you specifie the UTF-8 encoding.
I'm having the same problem with my code.. I'm getting the string from an XML then save it in a sqlite database using UTF-8 encoding. When I went to display the data I use this code:
I'm having the same problem with my code.. I'm getting the string from an XML then save it in a sqlite database using UTF-8 encoding. When I went to display the data I use this code:
Displaying the html string in console show a well formatted HTML code but the UIWebView doesn't interpret the HTML code nor the \xxxx codes.
The strange stuff is that it loads the pictures so it interprets the img...
I found where was my mistake! I used another encoding when saving the string from the xml; I had to use the same encoding from the beginning to the end of the process.