Android Question greek characters from sqlite not shown in webview

Phayao

Active Member
Licensed User
Longtime User
Hello,

I like to display greek words from an sqlite DB in a webview, using <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> in the head. But that seems to change nothing.

Most characters are shown, but some are just left out, especially those with a tilde and accent as \ above.
example.png

example.png

For example: "υἱοῦ" the last character is missing,
"Δαυὶδ" = David, the i is mising
"τὸν" the middle character o is missing

When I load the cur.getstring(...) into a label, it is displayed nearly 100% correctly.
But to change to label element is very inconvenient - does someone has a good idea ?

Thanks a lot,

Chris
 
Last edited:

Phayao

Active Member
Licensed User
Longtime User
The images are broken.

If cur.GetString returns the correct value then it should look properly in WebView.

Check it with Log(cur.GetString(...))

Thank you Erel,
the broken links are because i put the link to a dropbox image, what obviously does not work.

Yes, the log gives the correct characters - but in the webview the characters with tilde and backward slash accent are missing.
I also took out any css formatting of the table where i present the words and even let out any formatting as table - still the same :-(
Any idea ?

Thank you, Chris
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Hi Erel,

with Log(cur.Getstring(..)) I get the greek word back as it is in the DB, in the right way.
For example - in the DB: Δαυὶδ -> the output is the same: Δαυὶδ
But when I show it in a table in webview, the i is missing (Δαυ δ).
I have the feeling it has something to do with character encoding.
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
From the log the generated HTML is:
B4X:
<html><head><meta http-equiv='Content-Type' content='text/html charset=UTF-8' /></head><body>
<style type='text/css'>
        table {width: 100%;border: 1px solid #cef;text-align: left; }
        th { font-weight: bold;    background-color: #acf;    border-bottom: 1px solid #cef; }
        td,th {    padding: 4px 5px; }
        .odd {background-color: #def; } 
        .odd td {border-bottom: 1px solid #cef; }
        a { text-decoration:none; color: #000;}</style>
<table><thead><tr>
<th>ID</th><th>VERSE_ID</th><th>CONTEXTUAL_FORM</th><th>TRANSLITERATED_CONTEXTUAL_FORM</th><th>MORPHOLOGY_ID</th><th>STRONGS_WORD_ID</th><th>ENGLISH</th></thead></tr>
<tr><td>27</td><td>2</td><td>Ἰούδας</td><td>Ioudas</td><td>N-NMS</td><td>2455</td><td>Judah</td></tr>
<tr class='odd'><td>28</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr><td>29</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr class='odd'><td>30</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr><td>31</td><td>2</td><td>Φαρὲς</td><td>Phares</td><td>N-AMS</td><td>5329</td><td>Perez</td></tr>
<tr class='odd'><td>32</td><td>2</td><td>καὶ</td><td>kai</td><td>Conj</td><td>2532</td><td>and</td></tr>
<tr><td>33</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr class='odd'><td>34</td><td>2</td><td>Ζαρὰ</td><td>Zara</td><td>N-AMS</td><td>2196</td><td>Zerah</td></tr>
<tr><td>35</td><td>2</td><td>ἐκ</td><td>ek</td><td>Prep</td><td>1537</td><td>of</td></tr>
<tr class='odd'><td>36</td><td>2</td><td>τῆς</td><td>tēs</td><td>Art-GFS</td><td>3588</td><td>-</td></tr>
<tr><td>37</td><td>2</td><td>Θάμαρ,</td><td>Thamar</td><td>N-GFS</td><td>2283</td><td>Tamar;</td></tr>
<tr class='odd'><td>38</td><td>2</td><td>Φαρὲς</td><td>Phares</td><td>N-NMS</td><td>5329</td><td>Perez</td></tr>
<tr><td>39</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr class='odd'><td>40</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr><td>41</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr class='odd'><td>42</td><td>2</td><td>Ἑσρώμ,</td><td>Hesrōm</td><td>N-AMS</td><td>2074</td><td>Hezron;</td></tr>
<tr><td>43</td><td>2</td><td>Ἑσρὼμ</td><td>Hesrōm</td><td>N-NMS</td><td>2074</td><td>Hezron</td></tr>
<tr class='odd'><td>44</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr><td>45</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr class='odd'><td>46</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr><td>47</td><td>2</td><td>Ἀράμ,</td><td>Aram</td><td>N-AMS</td><td>689</td><td>Ram;</td></tr>
</table></body></html>

Although in the html output in the log, all characters are shown correctly - but in the webview the ὲ and Ἀ and ὸ are only blanks. o_O

Slowly I'm loosing my mind....
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works fine here:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("1")
   WebView1.LoadHtml($"<html><head><meta http-equiv='Content-Type' content='text/html charset=UTF-8' /></head><body>
<style type='text/css'>
        table {width: 100%;border: 1px solid #cef;text-align: left; }
        th { font-weight: bold;    background-color: #acf;    border-bottom: 1px solid #cef; }
        td,th {    padding: 4px 5px; }
        .odd {background-color: #def; }
        .odd td {border-bottom: 1px solid #cef; }
        a { text-decoration:none; color: #000;}</style>
<table><thead><tr>
<th>ID</th><th>VERSE_ID</th><th>CONTEXTUAL_FORM</th><th>TRANSLITERATED_CONTEXTUAL_FORM</th><th>MORPHOLOGY_ID</th><th>STRONGS_WORD_ID</th><th>ENGLISH</th></thead></tr>
<tr><td>27</td><td>2</td><td>Ἰούδας</td><td>Ioudas</td><td>N-NMS</td><td>2455</td><td>Judah</td></tr>
<tr class='odd'><td>28</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr><td>29</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr class='odd'><td>30</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr><td>31</td><td>2</td><td>Φαρὲς</td><td>Phares</td><td>N-AMS</td><td>5329</td><td>Perez</td></tr>
<tr class='odd'><td>32</td><td>2</td><td>καὶ</td><td>kai</td><td>Conj</td><td>2532</td><td>and</td></tr>
<tr><td>33</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr class='odd'><td>34</td><td>2</td><td>Ζαρὰ</td><td>Zara</td><td>N-AMS</td><td>2196</td><td>Zerah</td></tr>
<tr><td>35</td><td>2</td><td>ἐκ</td><td>ek</td><td>Prep</td><td>1537</td><td>of</td></tr>
<tr class='odd'><td>36</td><td>2</td><td>τῆς</td><td>tēs</td><td>Art-GFS</td><td>3588</td><td>-</td></tr>
<tr><td>37</td><td>2</td><td>Θάμαρ,</td><td>Thamar</td><td>N-GFS</td><td>2283</td><td>Tamar;</td></tr>
<tr class='odd'><td>38</td><td>2</td><td>Φαρὲς</td><td>Phares</td><td>N-NMS</td><td>5329</td><td>Perez</td></tr>
<tr><td>39</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr class='odd'><td>40</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr><td>41</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr class='odd'><td>42</td><td>2</td><td>Ἑσρώμ,</td><td>Hesrōm</td><td>N-AMS</td><td>2074</td><td>Hezron;</td></tr>
<tr><td>43</td><td>2</td><td>Ἑσρὼμ</td><td>Hesrōm</td><td>N-NMS</td><td>2074</td><td>Hezron</td></tr>
<tr class='odd'><td>44</td><td>2</td><td>δὲ</td><td>de</td><td>Conj</td><td>1161</td><td>moreover</td></tr>
<tr><td>45</td><td>2</td><td>ἐγέννησεν</td><td>egennēsen</td><td>V-AIA-3S</td><td>1080</td><td>begat</td></tr>
<tr class='odd'><td>46</td><td>2</td><td>τὸν</td><td>ton</td><td>Art-AMS</td><td>3588</td><td>-</td></tr>
<tr><td>47</td><td>2</td><td>Ἀράμ,</td><td>Aram</td><td>N-AMS</td><td>689</td><td>Ram;</td></tr>
</table></body></html>"$)
End Sub

SS-2018-05-30_10.14.59.png
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thank you Erel for trying that out.
Nevertheless, even I store the above html file as text file and read it into a webview, the mentioned characters are not shown for me (they are there in the html file). Maybe it's a Samsung specific problem, I'll try it out on another phone. Until now it remains a mystery.
Anyhow many thanks for your quick support, I appreciate the fantastic help in this forum. I'll post a new message when I manage to solve this issue.
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Hello,

when I use your code, the problem persists for me, no change, sorry.
I tried by using phone settings: default font and language English UK. No change.
So still some mystery remains.
(Another silly mistake from me: I am not able to insert a picture here, I do not know what the "image url" really means. The link to my dropbox is:
https://www.dropbox.com/s/hc4miuirfkuy0nv/Screenshot_2018-06-04-15-09-47.png?dl=0 )
 
Last edited:
Upvote 0
Top