×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    20

    How do I write unicode text on textField

    Hi, I am a new developer
    When I develope my app I have a problem and I can't solve it.
    In the mainForm of my app, I have a textField (search) in order to search from a list. I want to search unicode text (Vietnamese, chinese, ect...) which write into the textField , but I can't write unicode text into the textField
    Please help me and guide me how do I search in unicode text?
    Thanks in advance.
    Last edited by tieubinh; 2013-05-14 at 06:08.

  2. #2
    Registered User
    Join Date
    May 2013
    Posts
    20

    Re: How do I write unicode text on textField

    Who can help me?????

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: How do I write unicode text on textField

    Can you clarify the question further?
    Why cant you write vietnamese, chinease etc in your text field? do you have those languages installed on the phone? what UI are you using? (LCDUI or LWUIT)
    Java and J2me use a modified version of UTF-8 however you can get a pure UTF-8 encoding of the string using .getBytes("UTF-8") and from that there are alot of code samples available if you want to convert the bytes array to a unicode string literal representation such as
    http://www.java2s.com/Tutorial/Java/...codeformat.htm
    http://www.java2s.com/Code/Java/Deve...terUnicode.htm

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    20

    Re: How do I write unicode text on textField

    Thanks for your helping,
    I am using emulator, so it isn't installed any other languages.
    When I write unicode text to textField it always encrypt to special characters such as: square
    So I want to display what I write into unicode text such as: when I write "vieetj nam", I want to display: "việt nam", but it always display: "vi(square)t name"
    Do I need to installed another language to emulator?
    And how can I convert unicode text back to general text: such as english.
    thanks a lot.
    Last edited by tieubinh; 2013-05-15 at 04:40.

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104

    Re: How do I write unicode text on textField

    Quote Originally Posted by tieubinh View Post
    I am using emulator, so it isn't installed any other languages.
    Which one are you using. The latest come with the World-Languages Pack automatically. For older one, you start the emulator via the Windows Start menu, Edit menu » Preferences » there is a button to change the language and/or to install the World-Languages Pack.
    Quote Originally Posted by tieubinh View Post
    When I write unicode text to textField it always encrypt to special characters such as: square
    Then you do something wrong in your code or you do not use a Nokia emulator. Again, which one do you use?
    Quote Originally Posted by tieubinh View Post
    I want to display what I write into unicode text such as: when I write "vieetj nam", I want to display: "việt nam"
    No problem here.
    Quote Originally Posted by tieubinh View Post
    How can I convert unicode text back to general text: such as english.
    Java is Unicode based. Unicode defines which code-position a character has. For example ệ is \u1EC7. Beside this code-point/character mapping, there is ‘encoding’. Encoding describes how code-points are represented in bytes, for example in UTF-16 your character stays at 0x1ec7. In the encoding UTF-8, your character gets stored as 0xe1bb87.

    This is about code-points, bytes, characters. This does not say anything about the language you are using. A language is a subset of the glyphs in the Unicode code-point repository. Language does not matter to Unicode anymore. However, Unicode defines compatible characters, sometimes. More about this at Unicode.org, Wikipedia and on the Internet.

    Consequently, if your ệ is represented by \u0065\u0323\u0302 (which is the same as above) you are able to strip anything above code-point 127 (decimal) manually. This would give you an \u0065 which is an ‘e’. This stripping is actually a conversion of the encoding (from UTF-16 to US-ASCII). I think that is what you mean with English, or not? Not sure if \u0065\u0323\u0302 works with Nokia Series 40. Did that answer your question?
    Last edited by traud; 2013-05-15 at 10:40.

  6. #6
    Registered User
    Join Date
    May 2013
    Posts
    20

    Re: How do I write unicode text on textField

    Thanks very much about your helping,
    I am using Nokia SDK 2.0 for java
    I see what you said
    I want to ask another one question: I want to type Vietnames, so do i need to install Vietnames percussion?

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104

    Re: How do I write unicode text on textField

    Nokia SDK 2.0 comes with the World-Language Pack automatically. Have you unticked it while you were installing the SDK? If so, please start SDK Manager via the Windows Start menu. From the SDK Manager install the World Languages Pack.

    After doing that, you are able to change the emulator to Vietnamese via the Menu » Tools » Preferences. Furthermore, in the device (emulator) itself » Settings » Text editors » Writing Languages, you are able to add the Vietnamese soft-keyboard. One menu level back, you are able to switch between full- and phone-keyboard. If you go for Menu » Tools » Switch to Landscape, you always get the full-keyboard.

    Alternatively, you can type directly with the keyboard of your computer.

    Just tested it with the Nokia 305 emulator. Works here. Did that help?

  8. #8
    Registered User
    Join Date
    May 2013
    Posts
    20

    Re: How do I write unicode text on textField

    That's awesome!
    Thanks a lot for your helping

Similar Threads

  1. How write unicode in file S40
    By azspider in forum Mobile Java General
    Replies: 2
    Last Post: 2013-03-20, 20:46
  2. LWUIT TextField - Removing InputModeOrder Text "Abc" from TextField
    By vishal.vpb in forum Mobile Java General
    Replies: 1
    Last Post: 2011-11-14, 06:29
  3. very simple middlet class to write to write a text file
    By a_sina_a in forum Mobile Java General
    Replies: 10
    Last Post: 2008-03-07, 16:35
  4. Replies: 0
    Last Post: 2004-10-07, 08:57
  5. write any unicode chars in ABC mode
    By mhamed24 in forum Symbian
    Replies: 1
    Last Post: 2004-05-02, 03:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •