Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

How to Convert \r\n to \n

Thread view: 
Sachin - 20 Jan 2006 10:22 GMT
I download an opensource java program named chabria text normalizer
which normalizes a string according to a set of rules defined in a
seperate file. This file is read by the program to apply rules. Source
for parse this rules is auto generated by another opensource program
named JavaCC. I run this program on Wndows
When i change something this file program throws an exception " replace
\r\n with \n ....".
I use notepad on windows to edit the rule file.
Notepad use \r\n to present newline, and i think this may be thew cause
for this error. And this text normalizer program is generated on a Unix
platform.
I want to run this on Windows and please tell me how do I avoid this.
This is realy a headache for me.
Dave Glasser - 20 Jan 2006 14:01 GMT
"Sachin" <mahalwarawa@gmail.com> wrote on 20 Jan 2006 02:22:50 -0800
in comp.lang.java.programmer:

>When i change something this file program throws an exception " replace
>\r\n with \n ....".

Gee, that's a very odd error message. There's not much information
there. I wonder why the progammer chose to end his error message with
"...."?

Signature

Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net

If you're a musician, check out RPitch Relative Pitch
Ear Training Software.

http://rpitch.sourceforge.net

Steve Horsley - 20 Jan 2006 18:03 GMT
> I download an opensource java program named chabria text normalizer
> which normalizes a string according to a set of rules defined in a
[quoted text clipped - 9 lines]
> I want to run this on Windows and please tell me how do I avoid this.
> This is realy a headache for me.

You could try and look for a proggy called dos2unix that converts
text files this way. It usually comes with its friend, unix2dos.

Steve
Steve W. Jackson - 20 Jan 2006 20:57 GMT
> > I download an opensource java program named chabria text normalizer
> > which normalizes a string according to a set of rules defined in a
[quoted text clipped - 14 lines]
>
> Steve

Better still, lose Notepad.  Wordpad understands Unix-style line endings.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Oliver Wong - 20 Jan 2006 22:08 GMT
> Better still, lose Notepad.  Wordpad understands Unix-style line endings.

   If this is true, I was unable to find the feature in Wordpad that allows
one open an ASCII file with Microsoft-style line endings, and then re-save
it as an ASCII file with Unix-style line endings.

   The OP may be interested in more feature-filled text editors. I use
jEdit, and to perform the conversion, you just need to open the document,
and choose the menu "Utitilies->Buffer Options". A window will pop up, and
one of the drop down menus reads "Line seperator". Set this to "Unix (\n)"
and save the document.

http://www.jedit.org/

   - Oliver
Raymond DeCampo - 22 Jan 2006 02:29 GMT
>>Better still, lose Notepad.  Wordpad understands Unix-style line endings.
>
>     If this is true, I was unable to find the feature in Wordpad that allows
> one open an ASCII file with Microsoft-style line endings, and then re-save
> it as an ASCII file with Unix-style line endings.

I think by "Wordpad understands Unix-style line endings", Steve meant
that a file with \n line separators can be opened in a sane manner by
Wordpad.  I wouldn't read into this the ability to change back and forth
between them.

>     The OP may be interested in more feature-filled text editors. I use
> jEdit, and to perform the conversion, you just need to open the document,
[quoted text clipped - 3 lines]
>
> http://www.jedit.org/

I'll second that recommendation.  Unfortunately however you may
sometimes be working on Windows machines where you do not have the
ability to install applications or maybe you just want to quickly view a
log file.  In that case, it is good to understand what both Notepad and
Wordpad can do for you.  (Believe it or not, there are cases where
Notepad is superior.)  This is analogous to the Unix admin's need to
know vi, even if they prefer something else.

HTH,
Ray

Signature

This signature intentionally left blank.

Hendrik Maryns - 22 Jan 2006 22:06 GMT
Steve W. Jackson uitte de volgende tekst op 01/20/2006 09:57 PM:

>>> I download an opensource java program named chabria text normalizer
>>> which normalizes a string according to a set of rules defined in a
[quoted text clipped - 16 lines]
>
> Better still, lose Notepad.  Wordpad understands Unix-style line endings.

Better still, get notepad2: http://www.flos-freeware.ch/notepad2.html,
that doesn?t give you the inconvenience of wordpad trying to save
everything as rtf which is opened by Word the next time.

H.
- --
Hendrik Maryns

==================
www.lieverleven.be
http://aouw.org


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.