title: Carriage Return("\r\n") in java
body: <p>I have a created text file in unix enviroment using java code.</p>
  
  <p>For writing the text file i am using java.io.FileWriter and BufferedWriter. 
  and for newline after each row i am using bw.write("\r\n") method.
  (where bw is object of BufferedWriter) and sending that text file by attaching in mail from unix environment itself to other environments like(mainframe,windows)</p>
  
  <p>My issue is, if my client's download the text file in Mainframe system, 
  they found that in text file a "special character"(like small rectangular box) 
  presenting and data not properly aligned. </p>
  
  <p>bw.write("\r\n") is not working i think so..(but working fine in windows).</p>
  
  <p>I want same text file alignment as it is in unix environment and without any special<br>
  character symbol too, if they opened the text file in mainframe ,windows environments
  or any other enviroments.</p>
  
  <p>How to resolve the problem. Thanks for your help in advance.</p>
  
  <p>pasting my piece of java code here for your reference..(running java code in unix<br>
  environment)</p>
  
  <pre><code>File f = new File(strFileGenLoc);
  BufferedWriter bw = new BufferedWriter(new FileWriter(f, false));
  rs = stmt.executeQuery("select * from jpdata");
  while ( rs.next() ) {
     bw.write(rs.getString(1)==null? "":rs.getString(1));
     bw.newLine();
  }
  </code></pre>