Android Question Download html website accent characters are displaying like question mark caracter

Efo74

New Member
Licensed User
Hello,

Can someone helpme ??

I'am a newby in b4a. I made an app that download htmlpage from internet link . That downloaded page is filtered and I display only some parts. I use j.gestring or j.getring2("UTF8") to get the page, but If in the page compare accent carachers like à ù ò ì they are converted to ? question mark. Is there a way to fix this situation anche correct read this characters ? Than you
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code to parse the charset:
B4X:
Sub Process_Globals
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Dim j As HttpJob
   j.Initialize("j", Me)
   j.Download("http://www.rsn.it/")
End Sub

Sub JobDone(j As HttpJob)
   If j.Success Then
     Dim m As Matcher = Regex.Matcher2("<meta [^>]+charset=([^""]+)", Regex.CASE_INSENSITIVE, j.GetString)
     Dim charset As String = "utf8"
     If m.find Then
       charset = m.Group(1)
       Log("Found charset: " & charset)
     End If
     Log(j.GetString2(charset))
   End If
   j.Release
End Sub
 
Upvote 0
Top