B4J Question Accented Characters in Textfield Do Not Appear Correctly

jroriz

Active Member
Licensed User
Longtime User
Hi.

When I type accented characters in textfields, they do not appear correctly. When I type "~" followed by "a", instead of having "ã", I have "~ã". Any idea?

upload_2017-7-9_17-19-3.png
 

jroriz

Active Member
Licensed User
Longtime User
It's probably javaFX.
Any suggestions to fix the problem?
I do not know what to do except try something in textchanged.
 
Upvote 0

jroriz

Active Member
Licensed User
Longtime User
Using new produces a loop. I managed as follows:

B4X:
Sub TextField1_TextChanged (Old As String, New As String)
    Dim i As Int = TextField1.SelectionStart
    'TextField1.Text = Regex.Replace("~(.)", New, "$1") 'replace all tildes that are not the last character.    
    TextField1.Text = Regex.Replace("~(.)", TextField1.Text, "$1") 'replace all tildes that are not the last character.
    'TextField1.Text = TextField1.Text.Replace("~ã","ã")   ' works too
    TextField1.SetSelection(i,i)
End Sub
 
Last edited:
Upvote 0
Top