Show Some Love
JAVA

notepad doesn't recognize \n character?

This forum was posted on Tuesday, May 21, 2013 11:42:39 AM


I'm copying little css classes to one file. Classes get copied fine but I hv a issue that when I'm attempting to open it using notepad it gives one square Rather of char. It opens well in Edit+. Here is my code snippet:

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("
");
}

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= part0.concat(";").concat("}");
}
String m = input.substring(0 s).trim().concat("{
")
.concat(input.substring(s + 1 w + 1).trim())
.concat(input.substring(w + 1 p));
String a = m.split(";");
String main = "";
for (String segment : a) {
if (segment.having("rgb")) {
segment = change(segment);
}
if(segment.having("FONT-FAMILY") || segment.having("font-family")){
part=process(segment);
}
main = main.concat(segment.trim().concat(";")).concat("
");
}
main = main.concat("}");
return main;
}

How can i make it show up properly in notepad?


55 Viewed this Question



 Recent Replies on "notepad doesn't recognize \n character?"

  • Nobody has replied on this post, be first to post answer.

Post Your Solution for this Question


Note: Please Put Code into <code></code> block.

Threads related to "notepad doesn't recognize \n character?":

Is there a Java library for steganography?

By library I mean a use-ready .jar distribution.Image steganography would suffice. Working with JPEG PNG and BMP would be sufficient too.Google yields no usable o/p - mostly explanations and guides but no libraries.

Testing for custom plugin portlet: BeanLocatorException and Transaction roll-back for services testing

My issues:I can test successfully for CRUD services operation. I was doingan insert on @Before setUp() and delete of similar data on @AftertearDown() but going forward I would require to support Transactionsrather than writing code snippet snippet for insert and delete.I am successful in fetching single records of my entity but when I fire a search query or try to fetch more than one of my entities I get:com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet contex

Can catalina.bat change environment variables?

I am inheriting a project and (per the other developer's instructions) overwrote my Tomcat's Ver. of catalina.bat with his (he's using the similar Ver.). I then tried to restart Tomcat and got an exception relating to the commons-logging.jar which is a Tomcat dependency.After a lot of frustration I just downloaded a various Ver. of Tomcat and tried running it right out of the box (no configuration)...and I got the similar error!So I asked this issue on SO a little days ago. The con

Play music on the same time with my JFrame

In my app I hv add little music to my JFrame home. Now When I run it on my main There is no problem he opens the Home JFrame and on the similar time the music is playing.import Muziek.Sound;import View.Home;public class Main { public static void main(String args) { Home home = new Home(); home.setVisible(true); }}But now When I execute my Home class the JFrame becomes white while the music is playing and when the music stops i be possible to see my JFrame. Now I hv read somethi

Is Collections.shuffle() really random enough? Practical examples seem to deny this statement

I hv 1000 unique objects in a java.util.List each implying to an image each image in the 1000-list is unique and now i wish to shuffle them so that I can use the first 20 objects and present them to the website-user.The user can then click a button saying "Shuffle" and I recover the 1000 images again from scratch and calling again shuffle().However it seems that out of 1000 image objects I very often see the similar image again and again between the 20-image-selection

Spring Webservice Client: Cannot handle SOAP faults

In my project I made a webservice member with Spring Web Services (2.0.4.RELEASE).The webServiceTemplate is defined in my spring config: When I call the service (wsClient.marshalSendAndReceive(...)) and it returns a SOAP fault the webservice member doesn't recognize it.It tries to marshall it and a ValidationException is thrown.I looked at the Spring Web Service source code snippet snippet. In the WebServiceTemplate class exists a method protected boolean hasFault(WebServiceConnection connection WebServ

URI mapping not accessible

i'm working with Netbeans... in the Glassfish server log I seeINFO: Loading XML bean definitions from ServletContext resource /WEB-INF/app-config.xmlINFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanningINFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanningINFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiringINFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory

java swing: single click event to work as double click

How do I make single click action to work as double click in windows we have functionality like when we click on folder it will open on single click.in java is There is any approach to do it?on one click it should select the folder and open the folder.

Logging HTTP 404 events in a RESTful service

I hv made server using Rest in java. i require to log 404(Not found ) msg. the case is I hv resources Post /player Get /game Get /player/id on server.But if member request for /xyz resource that is not on server member finds 404(not found).But i require to log for it on server too.I am not getting How do I find it on server side.Plz advise.

How to add application to System Tray

i require to add my application to the system tray when it's window is closed (similar to the Google Talk application). And then when I click the on icon in the system tray the application window becomes active again. How can i do this in Java? final SystemTray tray = SystemTray.getSystemTray();Image image = Toolkit.getDefaultToolkit().getImage("images.jpg");final TrayIcon trayIcon = new TrayIcon(image);try { SystemTray.getSystemTray().add(trayIcon);} catch (AWTException e2) { e2.printStackTrace();}this.addW