sirjo66 Well-Known Member Licensed User Longtime User Aug 14, 2014 #1 Hello, I'm trying to convert an ISO-8859-1 string into UTF8 string format for to view it in WebView view. This is the problem: I download this page http://www.teletexto.com/teletexto.asp?programacion=Antena 3&tv=n with HTTP and the result go into a "Html" String variable. If you take a look at html source, you see that this page is in iso-8859-1 character set. So, if I use: B4X: webviewobject.LoadHtml(Html) I don't see correct text (see image1.png). I have try to change iso-8859-1 text into utf8 text but I don't know how to do it. I have try each of it: B4X: Dim arr() As Byte = Html.GetBytes("ANSI") Html = BytesToString(arr, 0, arr.Length, "UTF8") B4X: Dim arr() As Byte = Html.GetBytes("Windows-1252") Html = BytesToString(arr, 0, arr.Length, "UTF8") B4X: Dim arr() As Byte = Html.GetBytes("iso-8859-1") Html = BytesToString(arr, 0, arr.Length, "UTF8") But don't work Sergio Attachments image1.png 95.5 KB · Views: 459
Hello, I'm trying to convert an ISO-8859-1 string into UTF8 string format for to view it in WebView view. This is the problem: I download this page http://www.teletexto.com/teletexto.asp?programacion=Antena 3&tv=n with HTTP and the result go into a "Html" String variable. If you take a look at html source, you see that this page is in iso-8859-1 character set. So, if I use: B4X: webviewobject.LoadHtml(Html) I don't see correct text (see image1.png). I have try to change iso-8859-1 text into utf8 text but I don't know how to do it. I have try each of it: B4X: Dim arr() As Byte = Html.GetBytes("ANSI") Html = BytesToString(arr, 0, arr.Length, "UTF8") B4X: Dim arr() As Byte = Html.GetBytes("Windows-1252") Html = BytesToString(arr, 0, arr.Length, "UTF8") B4X: Dim arr() As Byte = Html.GetBytes("iso-8859-1") Html = BytesToString(arr, 0, arr.Length, "UTF8") But don't work Sergio
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2014 #2 You should use Job.GetString2 with the correct encoding. Upvote 0
sirjo66 Well-Known Member Licensed User Longtime User Aug 15, 2014 #3 It works !! Thanks Sergio Upvote 0