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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:06:16+00:00 2026-05-28T11:06:16+00:00

In my Bundle, I’m trying to display utf-8 characters, I suppose my default charset

  • 0

In my Bundle, I’m trying to display utf-8 characters, I suppose my default charset is Cp1250 and strange behaviour happens:

public class Activator implements BundleActivator {

    public void start(BundleContext context) throws Exception {
        System.out.println("ąśżłóę"); // this is what should've been displayed
        System.out.println("������"); // this is the utf8 above encoded to cp1250
    }

    public void stop(BundleContext context) throws Exception {
    }

    public static void main(String args[]){
        System.out.println("ąśżłóę"); //utf-8
        System.out.println("������"); //cp1250
    }
}

Output when I run main, I get what I expected:

ąśżłóę
ąśżłóę

Output when I start a Bundle from an OSGi Framework, characters are encoded from utf-8 to cp1250. So the output is exactly opposite.

ąśżłóę
ąęźł

So my question is: how to deal with it? Should I write an application in cp1250 instead of utf-8? Or is it possible to change osgi default charset?

  • 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-28T11:06:17+00:00Added an answer on May 28, 2026 at 11:06 am

    A few notes:

    • When compiling Java sources, ensure your compiler encoding matches your editor encoding (usually not a problem in an IDE)
    • At runtime Java Strings are always UTF-16 (the class format stores literals as modified UTF-8, but developers don’t have to worry about this)
    • System.out will transcode the UTF-16 strings to the default platform encoding; this may be a lossy process if the encoding is not Unicode
    • If the stdout stream consumer (console or whatever other application) does not decode its input using the same encoding, character corruption may occur
    • There is no supported mechanism for changing the default platform encoding in the JRE (and that includes using -Dfile.encoding=foo)

    How you would correct the output would depend on the device you’re trying to write to. See here and here for cmd.exe. See here for more general info on Java encoding.

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

Sidebar

Related Questions

The method onCreate(Bundle) is undefined for the type AppWidgetProvider public class SupermarioActivity<imageButton1> extends AppWidgetProvider
I have an OSGi bundle b1 exporting a class with public static final String
Initially my app's bundle identifier was the default MyCompany.${PRODUCT_NAME:rfc1034identifier} This wasn't matching the app
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.e(SMS,Hello World); //not showing Log.v(SMS,Hello World);
I am trying to bundle install the Rails project I pulled from GitHub. However,
I created a settings.bundle and added a few items. Now I am trying to
I have resource bundle with my country characters - how to change them into
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.full_image); ImageView image = (ImageView) findViewById(R.id.imageView1); Bitmap bMap
public Bundle getCaseInfo(String param) { Bundle b = new Bundle(); if(param.compareTo(Constants.CASE_INFO_SLECTED_TEETH) == 0) {
public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.detail); TextView forgot_pswrd = (TextView) findViewById(R.id.textView1); LinearLayout.LayoutParams llp

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.