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

  • Home
  • SEARCH
  • 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 7781503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:14:52+00:00 2026-06-01T19:14:52+00:00

My client uses InputStreamReader/BufferedReader to fetch text from the Internet. However when I save

  • 0

My client uses InputStreamReader/BufferedReader to fetch text from the Internet.
However when I save the Text to a *.txt the text shows extra weird special symbols like ‘Â’.

  • I’ve tried Convert the String to ASCII but that mess upp å,ä,ö,Ø which I use.

  • I’ve tried food = food.replace("Â", ""); and IndexOf();
    But string won’t find it. But it’s there in HEX Editor.

So summary: When I use text.setText(Android), the output looks fine with NO weird symbols, but when I save the text to *.txt I get about 4 of ‘Â’. I do not want ASCII because I use other Non-ASCII character.
The ‘Â’ is displayed as a Whitespace on my Android and in notepad.

Thanks!

Have A great Weekend!

EDIT:
Solved it by removing all Non-breaking-spaces:

myString.replaceAll("\\u00a0"," ");
  • 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-06-01T19:14:55+00:00Added an answer on June 1, 2026 at 7:14 pm

    You say that you are fetching like this:

    in = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8")); 
    

    There is a fair chance that the stuff you are fetching is not encoded in UTF-8.

    You need to call getContentType() on the HttpURLConnection object, and if it is non-null, extract the encoding and use it when you create the InputStreamReader. Only assume “UTF-8” if the response doesn’t supply a content type with a valid encoding.


    On reflection, while you SHOULD pay attention to the content type returned by the server, the real problem is either in the way that you are writing the *.txt file, or in the display tool that is showing strange characters.

    • It is not clear what encoding you are using to write the file. Perhaps you have chosen the wrong one.
    • It is possible that the display tool is assuming that the file has a different encoding. Maybe it detects that a file is UTF-8 or UTF-16 is there is a BOM.
    • It is possible that the display tool is plain broken, and doesn’t understand non-breaking spaces.

    When you display files using a HEX editor, it is most likely using an 8-bit character set to render bytes, and that character set is most likely Latin-1. But apparently, the file is actually encoded differently.

    Anyway, the approach of replacing non-breaking spaces is (IMO) a hack, and it won’t deal with other stuff that you might encounter in the future. So I recommend that you take the time to really understand the problem, and fix it properly.


    Finally, I think I understand why you might be getting  characters. A Unicode NON-BREAKING-SPACE character is u00a0. When you encode that as UTF-8, you get C2 A0. But C2 in Latin-1 is CAPITAL-A-CIRCUMFLEX, and A0 in Latin-1 is NON-BREAKING-SPACE. So the “confusion” is most likely that your program is writing the *.txt file in UTF-8 and the tool is reading it as Latin-1.

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

Sidebar

Related Questions

If my .NET client uses System.IO.File.Copy to copy a file from \server1\share1\file1.txt to \sever1\share2\file2.txt
If my .NET client uses System.IO.File.Copy to copy a file from \server1\share1\file1.txt to \sever1\share2\file2.txt,
This samplet is from a project I am working on. My client uses software
A client uses classic ASP to log in to their web based backoffice. I
I have a testing PDA running on WM6.0. But my client uses WM5.0. Is
I have a very simple wcf server. When a client uses an operation contract,
I have a client that uses a point-of-sale solution involving an Access database for
I have an client who uses Magento. They asked me to redesign the site
I'm writing a simple socket client which uses only one socket. So I figured
I have a have Winforms client that uses Web services on a IIS7 (W2008)

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.