Android Question UTF16 characters in the "high" ranges

Discussion in 'Android Questions' started by Rusty, Jan 17, 2015.

  1. Rusty

    Rusty Well-Known Member Licensed User

    I am trying to display utf16 characters that are above 65000 and having difficulty getting it done.
    FE4E6 is the American Flag (as an example).
    How does one display this in a Webview, EditText or ???
    Thanks in advance.
    Rusty
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    upload_2015-1-18_9-23-24.png

    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.LoadLayout("1")
       WebView1.LoadHtml(
    "<p>&#xFE4E6;</p>")
     
       EditText1.Text = UnicodeToString(
    0xFE4E6)
    End Sub

    Sub UnicodeToString (codepoint As Int) As String
       
    Dim bc As ByteConverter
       
    Dim b() As Byte = bc.IntsToBytes(Array As Int(codepoint))
       
    Return BytesToString(b, 04"UTF32")
    End Sub
     
    yiankos1, jotaele and LucaMs like this.
  3. LucaMs

    LucaMs Expert Licensed User

    You should copy this your code to the section "Snippets", dear new member (Erel), please.

    Thank you
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Go ahead and add it ;)
     
  5. Rusty

    Rusty Well-Known Member Licensed User

    Thanks Erel!
    This looks like it runs on KitKat very well. Can it function on ICS or JellyBean?
    Rusty
    I tried it on ICS and it doesn't seem to work. Does ICS support the UTF16/32?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    It depends on the font. Try to use a custom font file that includes these characters.
     
  7. Rusty

    Rusty Well-Known Member Licensed User

    You are right. I had loaded a custom font and then later in the test program had loaded another ...
    I appreciate your help, Erel.
    Regards,
    Rusty
     
  8. Rusty

    Rusty Well-Known Member Licensed User

    In ICS, the B-) generates a Unicode character and this is working well. The edit text shows the correct smiley.
    How can I get the Unicode code point value? Is there a translation table for these texts? If so, it seems they vary between Android OS's...ICS, JB, ...
    The reason I need this is that I can't find a "map" that gives the code point value for the text representations (like above).
    Code:
    From ICS soft keyboard smiley button
    ":-)"
    "B-)"
    ":'("
    ":-["
    ":-!"
    ":)"
    ":-*"
    ":-D"
    ":-X"
    ":-$"
    ":-O"
    ":-P"
    ":-\"
    ";)"
    "o.O"
    ":0"
    ":-|"
    ":("
    "x-("
    "<3"
    Thanks,
    Rusty
     
  9. DonManfred

    DonManfred Expert Licensed User

    The editor-app for sms (or whatever you are looking at) seems to have the maps hardcoded...
    I dont know whether there exist an mapping for text-smilies to graphics.
     
  10. Rusty

    Rusty Well-Known Member Licensed User

    Thanks Manfred,
    We have written our own and as such, we are mapping them...
    Rusty
     
  11. Rusty

    Rusty Well-Known Member Licensed User

    Does anyone know how/where/which codepage/unicode values the Korean character set resides?
    If so, can you please advise on how I might reach this in code?
    Thanks,
    Rusty
     
  12. Erel

    Erel Administrator Staff Member Licensed User

  13. Rusty

    Rusty Well-Known Member Licensed User

    Thanks Erel.
    I need t be able to "combine" Unicode characters such as Korean where selecting consonants and vowels result in a single combined ligature/glyph.
    Does android/b4a support this function or is there a "formula" by which this can be accomplished?
    for example: ㅁ plus ㅕ results in the character 며 adding another ㅁ results in 몀
    Regards,
    Rusty
     
  14. Erel

    Erel Administrator Staff Member Licensed User

  15. Rusty

    Rusty Well-Known Member Licensed User

    :) Nothing wrong with being RUSTY, I've been that for my whole life :)
    Thanks for the speedy response.
    Do you know how to "Add" the consonant value to the vowel value that points to the codepage/glyph with the resultant character?
    Thanks,
    Rusty
     
    Erel likes this.
  16. Erel

    Erel Administrator Staff Member Licensed User

    I'm afraid no. Try to find a Java solution and I can help you convert it. I didn't find any.
     
  17. Rusty

    Rusty Well-Known Member Licensed User

  18. Erel

    Erel Administrator Staff Member Licensed User

    It works.
    Code:
    Dim s As String = "ㅁㅕ"
    Dim jo As JavaObject
    jo.InitializeStatic(
    "java.text.Normalizer")
    For Each form As String In Array("NFD""NFC""NFKD""NFKC")
       
    Log(jo.RunMethod("normalize"Array(s, form)))
    Next
    form should be either NFKD or NFKC
     
  19. Rusty

    Rusty Well-Known Member Licensed User

    Fantastic!
    thanks so much for your help, Erel!
    Rusty
     
  20. Rusty

    Rusty Well-Known Member Licensed User

    Are there other "formats" for normalize?
    Some of the combinations have multiple "pieces" i.e. "ㅁ", "ㅕ", "ㄱ" result in 멱
    When I send it an array of three elements, it doesn't combine all three, just the first two and then sets the third as an independent character.
    THanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice