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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:34:35+00:00 2026-06-17T11:34:35+00:00

I have a problem with encoding in JLabel on Windows(on *nix OSes everything is

  • 0

I have a problem with encoding in JLabel on Windows(on *nix OSes everything is okay).
Here’s an image: https://i.stack.imgur.com/Ti4Qr.png (the problematic character is the L with ` on the top, it should be ł) and here the code:

public void run()
    {
            URL url;
            HttpURLConnection conn;
            BufferedReader rd;
            String line;
            String result = "";
            try {
                url = new URL(URL);
                conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("GET");
                rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                while ((line = rd.readLine()) != null) {
                    result += line;
                }
                rd.close();
            } catch (Exception e) {
                try
                {
                    throw e;
                }
                catch (Exception e1)
                {
                    Window.news.setText("");
                }
            }
                Window.news.setText(result);
        }

I’ve tried Window.news.setText(new String(result.getBytes(), "UTF-8"));, but it hasn’t helped. Maybe I need to run my application with specified JVM flags?

  • 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-17T11:34:36+00:00Added an answer on June 17, 2026 at 11:34 am

    You are breaking the data before it gets to the window when you use new InputStreamReader with no explicit charset. this will use the platform default charset, which is probably cp1252 on windows, hence your broken characters.

    if you know the charset of the data you are reading, you should specify it explicitly, e.g.:

    new InputStreamReader(conn.getInputStream(), "UTF-8")
    

    in the case of downloading data from an arbitrary url, however, you should probably be preferring the charset in the ‘Content-Type’ header, if present.

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

Sidebar

Related Questions

I have problem like this https://dev.twitter.com/discussions/4563 if (webResponse.Headers[Content-Encoding] == gzip) { byte[] bytes =
I have a problem with encoding when writing XML files via QXmlStreamWriter in windows,
I have an encoding problem in Eclipse (Indigo Service Release 1). Here's what happens:
I have a problem with encoding while trying to get html from google.com. Please,
I have encoding problem with iText ( http://www.lowagie.com/iText/ ). I load data from database
I have here an old MySQL3 database with an encoding problem. Since the system
I have a problem here in encoding and decoding of a pdf or docx
I have a problem with utf-8 encoding in primefaces 3. but with this (adding
I have a litle problem with my text encoding, when user filed textarea field
I am experiencing some problem on UTF-8 Encoding. I have a CSV file and

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.