Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7439437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:42:23+00:00 2026-05-29T10:42:23+00:00

I have a UTF-16LE encoded string that comes from a server. I would like

  • 0

I have a UTF-16LE encoded string that comes from a server. I would like to print that string in Textview of my activity. However, the string prints with spaces in between them. So, “Hello” prints as “H e l l o” and doesn’t look all that nice in my screen.

Any help is appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:42:24+00:00Added an answer on May 29, 2026 at 10:42 am

    Assuming you have a stream (or array of bytes) containing a UTF-16LE encoded string.

    String str0 = "Hello, I am a UTF-16LE encoded String";
    byte[] utf16le = str.getBytes("UTF-16LE");
    

    If you do not convert these back & stating the character set used you will be producing a string containing a lot of 0-bytes (UTF-16LE is, obviously, 16-bit) in your resulting String.

    String wrong = new String(utf16le); // This will produce crap with \0:s in it.
    String correct = new String(utf16le, "UTF-16LE"); // This will be the actual string.
    

    Note: If you dump crap String:s like these into a TextView in ICS it will remove the garbage for you and not print “H e l l o”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a collection of files encoded in ANSI or UTF-16LE. I would like
I have UTF-8 encoded NSData from windows server and I want to convert it
I have a UTF-8 encoded file and would like to pop an output stream
C# question here.. I have a UTF-8 string that is being interpreted by a
I am retrieving emails and some of my emails have utf encoded text. However
I have a UTF-16 encoded xmlstring that I want to parse with php. encoding
I have a UTF-8 encoding string I am getting from reading a PDF, and
I would like to make sure that everything I know about UTF-8 is correct.
So I have a UTF-8 encoded string which can contain full-width kanji, full-width kana,
I have UTF-8 string(from DB), and when i run: echo rawurldecode('S = ( a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.