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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:08:34+00:00 2026-05-31T10:08:34+00:00

I am copying some css classes to one file. Classes get copied very well,

  • 0

I am copying some css classes to one file. Classes get copied very well, but I have a problem that when I am trying to open it using notepad it gives one square instead of \n character. It opens well in Edit+. Here is my code:

String fileName = new File(oldFileName).getName();
BufferedWriter out = null;

FileWriter fw = new FileWriter("D:\\temp\\UPDATED_"+fileName);
out = new BufferedWriter(fw);

for (CSSStyleRule p : finlist.values()) {
    String t = null;
    String m = p.toString();
    if (m.charAt(0) == '*') {
        t = m.substring(1);
    } else {
        t = m;
    }

    String main = format(t);
    out.write(main);
    out.write("\n");
}

also see this format() function

private static String format(String input) {
        int s = input.indexOf('{');
        int p = input.indexOf('}');
        int w = input.indexOf(';');
        if(w==-1)
        {
            w=p-1;
            String []part=input.split("}");
        input=  part[0].concat(";").concat("}");
        }

        String m = input.substring(0, s).trim().concat("{\n")
                .concat(input.substring(s + 1, w + 1).trim())
                .concat(input.substring(w + 1, p));
        String a[] = m.split(";");
        String main = "";
        for (String part : a) {
            if (part.contains("rgb")) {
                part = convert(part);
            }
            if(part.contains("FONT-FAMILY") || part.contains("font-family")){
                part=process(part);
            }

            main = main.concat(part.trim().concat(";")).concat("\n");
        }
        main = main.concat("}");
        return main;

    }

How to make it show up properly in notepad?

  • 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-31T10:08:35+00:00Added an answer on May 31, 2026 at 10:08 am

    Windows uses \r\n for new line. Use the line.separator property instead:

    public static String newLine = System.getProperty("line.separator");
    //...
    out.write(newLine);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C++0x, is it legal / expected that some classes can be copied but
I have problem with copying sdf file to WM emulator. My solution structure MyApp.DataLayer
I'm trying to do something that should be very simple, but it's causing this
I am copying and pasting some IBOutlets from one view to another scrollview. But
I've got a question about copying some xml, with xslt. I have xml that
I have a custom action and need to get below values for copying some
In Codegear RAD Studio 2007, I'm trying to do some file deletion and copying
I'm copying a subset of some data, so that the copy will be independently
I have a chat window (using a <div> ) that sometimes needs to get
I am copying some user data from one SqlServer to another. Call them Alpha

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.