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 771423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:39:04+00:00 2026-05-14T18:39:04+00:00

I want to know how to receive the string from a file in Java

  • 0

I want to know how to receive the string from a file in Java which has different language letters.

I used UTF-8 format. This can receive some language letters correctly, but Latin letters can’t be displayed correctly.

So, how can I receive all language letters?

Alternatively, is there any other format which will allow me to receive all language letters.

Here’s my code:

URL url = new URL("http://google.cm");

URLConnection urlc = url.openConnection();
BufferedReader buffer = new BufferedReader(new InputStreamReader(urlc.getInputStream(), "UTF-8")); 
StringBuilder builder = new StringBuilder(); 
int byteRead; 
while ((byteRead = buffer.read()) != -1)
{ 
    builder.append((char) byteRead);
} 

buffer.close();

text=builder.toString();

If I display the “text”, the letters can’t be displayed correctly.

  • 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-14T18:39:05+00:00Added an answer on May 14, 2026 at 6:39 pm

    Reading a UTF-8 file is fairly simple in Java:

    Reader r = new InputStreamReader(new FileInputStream(filename), "UTF-8"); 
    

    If that isn’t working, the issue lies elsewhere.

    EDIT: According to iconv, Google Cameroon is serving invalid UTF-8. It seems to actually be iso-8859-1.

    EDIT2: Actually, I was wrong. It serves (and declares) valid UTF-8 if the user agent contains “Mozilla/5.0” (or higher), but valid iso-8859-1 in (some) other cases. Obviously, the best bet is to use getContentType to check before decoding.

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

Sidebar

Related Questions

In our application, we receive messages from JMS Topic. First I want to know
I want to know if there is way to call javascript from java on
I want to receive the lists from a specific site URL. I know how
want to know why String behaves like value type while using ==. String s1
I want to know the differences of File API in html5 and previous version.
I'm working on an android app that has to send and receive information from
I am trying to receive a file (audio, .CAF) from a socket in C
I am having a InputStream Object which is actually a zip file. I want
Which libraries should I look into for the following tasks? I want to receive
I want to receive json object from view to controller using $.ajax method but

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.