Android Question french accentued characters inside webview form

hub73

Active Member
Licensed User
Longtime User
Hello.
I've the following problem inside a webview. I can't display the 'ê' or 'ë' character inside a textarea or form text item (<inputtype="text"name="lastname">) when i enter some text.

i use logitech k400r keyboard.
my device : a google tv device mk808b plus.

Note : on the same device, i can use chrome and display correctly the 'ê' when simultaneously i press the 'e' and '^' key inside any textarea or text field. (Should be a logitech specific application task)

not sure to have a method to do this. Is it possible to send a text or ascii code to a form item inside a webview ?

Many thanks.
 

eurojam

Well-Known Member
Licensed User
Longtime User
you can use file.writestring and file.readstring, the string will be converted into utf8, like in this example:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim wv As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    wv.Initialize("wv")
    Activity.AddView(wv,0,0,100%x,50%y)
    Dim t As String = "ê ö ä  ë"
    File.WriteString(File.DirInternal,"tmp.txt",t)
    t = File.ReadString(File.DirInternal,"tmp.txt")
    wv.LoadHtml(t)

End Sub
 
Upvote 0

hub73

Active Member
Licensed User
Longtime User
This is when i use the loaded page inside the webview. When i put some text inside a html form field with my keyboard ! (or textarea displayed)...

Not sure to find a way to correct this.

thanks for your reply eurojam

(No problem with UTF8 on displayed text as i've already the accentued characters displayed on the html page )
 
Last edited:
Upvote 0

hub73

Active Member
Licensed User
Longtime User
i don't know if you can send a text directly into a displayed webview form field (focus on) with b4a. Not seems to be possible. For exemple press a key and send the 'ê'.
 
Upvote 0

hub73

Active Member
Licensed User
Longtime User
another idea ... use the android clipboard ? I send the 'ê' character to it and next use 'paste' ?

Work fine to paste the 'ê' on the webview form.

Now is there a method to automatically set a text (my 'ê') inside the android clipboard ?

Method :
1) i press a b4a form button : 'ê' sent to clipboard.
2) i press a key (CTRL+e for example) -> paste the clipboard where i am the 'ê'.


Need help or code sample for 1)

Thanks !
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…