Jump to content


Photo

Notepad makes script messy?


  • Please log in to reply
5 replies to this topic

#1 Renex

Renex

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 03 March 2008 - 04:18 AM

Hi all,

Ive noticed a problem with the windows application "Notepad.exe". Everytime i open a CSS, HTML, PHP, XML or any script file up in notepad it messes the whole code up. Here is an example of a small portion of code from my style.css.

This is how it is supposed to look:

/*
+--------------------------------------------------------------------------
| Cascading Style Sheet for MKportal "default" Portal Template
| ========================================
| by Meo aka Luponero [Amedeo de longis]
| Don K. Colburn [visiblesoul.net]
| © 2004-2007 mkportal.it
| http://www.mkportal.it
| Email: [email protected]
+--------------------------------------------------------------------------
| > MKPortal
| > Written By Amedeo de longis
| > Date started: 9.2.2004
+--------------------------------------------------------------------------
*/

/*=============================
M
K global styles
P
=============================*/
body {
background-color: #efefef;
font-size: 10px;
color: #666666;
font-family: Verdana, Arial, Helvetica, sans-serif;
margin:0px;
padding:0px; /* Opera 0 margin */
text-align: center; /* center in IE */
}

/* portal wrapper */
#mkwrapper {
text-align:left; /* left-align text in IE */
margin: 0px auto 0px auto;
}

/* logostrip */
#mklogostrip {
/* background-image: url(MKPORTALIMGDIR/sf_logo.jpg); */
background-color: #8cb6e7;
text-align: left;
}


This is what it look like after been opened up in Notepad.exe:

/*+--------------------------------------------------------------------------| Cascading Style Sheet for MKportal "default" Portal Template| ========================================| by Meo aka Luponero [Amedeo de longis]| Don K. Colburn [visiblesoul.net]| © 2004-2007 mkportal.it| http://www.mkportal.it| Email: [email protected]+--------------------------------------------------------------------------| > MKPortal| > Written By Amedeo de longis| > Date started: 9.2.2004+--------------------------------------------------------------------------*//*=============================MK global stylesP=============================*/body { background: #000 url('http://www.gta4gamers.com/back_bg.jpg') center top no-repeat fixed; font-size: 14px; color: #666666; font-family: Tahoma, Arial, Helvetica, sans-serif; margin:0px; padding:0px; /* Opera 0 margin */ text-align: center; /* center in IE */ }/* portal wrapper */#mkwrapper { text-align:left; /* left-align text in IE */ margin: 0px auto 0px auto;}/* logostrip */#mklogostrip { /* background-image: url(MKPORTALIMGDIR/sf_logo.jpg); */ background-color: #8cb6e7; text-align: left;}/* global font formatting */table,tr,td { font-size: 11px; color: #cccccc; font-family: Tahoma, Arial, Helvetica, sans-serif; }/* Inside Block Font */.tdglobal {font-size: 11px; color: #cccccc; font-family: Tahoma, Arial, Helvetica, sans-serif; }/* main portal table */.tabmain { margin:0px; padding:0px; }/* images */img { border: 0px; vertical-align: middle; /* Meo: Added in C1.2 */}/*=============================MK LIGHT BACKGROUNDP=============================*/.urlo2,.taburlo { background-color: #111111; color: #666666;}/*=============================MK MEDIUM BACKGROUNDP=============================*/.navigatore,.moduleborder { background-color: #000000; color: #496c9f;}/*=============================MK NEWS BLOCK BACK COLORSP=============================*/.trattini,.modulecell,.taburlo {background-color: #101010; color: #666666;}/*=============================MK NEWS BLOCK COLORSP=============================*/.tabnews {background-color: #242424; color: #666666;}/*=============================MK TABLE BACKGROUNDP=============================*/.tabmain {background-color: #


Im quite confused why it keep's happening, has anyone seen this before here and know why it happens? it dosen't seem to happen when opening code up in any of editors. Also is there a way to fix it when this happens because my CSS is kinda screwed :P

Thanks, Neil. :rolleyes:


#2 Dragolux

Dragolux

    Young Padawan

  • Members
  • Pip
  • 123 posts
  • Gender:Male
  • Location:United States
  • Interests:I love computers! I love Photoshop, Flash, Blender, Firefox, I love, well, EVERYTHING!!<br /><br />:D

Posted 03 March 2008 - 05:45 PM

Unfortunately, I see this all the time. It must have something to do with new line characters in newer editors or something.

What you should do is get the better version of Notepad. It's called Notepad2, and you can download it from Flo's Freeware.

Whenever you open a text/script document in this editor, it automatically converts all the new line characters (or whatever) correctly, and displays the file properly.

I hope this answered your question!

#3 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 03 March 2008 - 07:45 PM

Here's the deal, new-line characters are not standardized across Operating Systems.

Windows uses: \r\n
Mac uses: \r
Linux uses: \n

Any text editor worth using will recognize any combination of the above and display it correctly. However, even in Vista, Notepad is a little too stuborn, or old-school, to accept anything other than \r\n. So if the file was saved on a non-Windows platform, Notepad will not read it correctly. To fix the problem, just open a text editor that does know what it's doing, save the file, and re-open it in notepad. Then you should be good to go.

If you want more info, something may show up in the following link. Dunno what though, didn't read it.
http://en.wikipedia.org/wiki/Newline

And as a side note, if you've attempted the above fix and it didn't work, make sure your editor is set to save the file using the proper newline characters (i know in Eclipse, this is an option).

Edited by rc69, 03 March 2008 - 07:46 PM.


#4 Renex

Renex

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 04 March 2008 - 04:52 AM

Hi there,

Notepad2, doesnt seem to be doing anything ive downloaded it, and running it on a Windows Vista PC however ive pasted the full CSS code into the editor and set the mode of the editor to CSS style but as far as it goes for saving etc.. nothing changes.. quite confused now, you would of thought that they would of updated it since it's a new version of windows but that's just microsoft for you lol :)

I looked at that document what rc69 gave me:


That's what i found on the site, is CR+LF the new character lines? if so, would i have to find an editor which would support them. I don't think the newest version of dreamweaver would support the new line characters would it?

EDIT: Although the Notepad2 editor does support CR+LF and is set on that but still does not display right, anyone have anymore ideas up there sleves? B)

thanks, neil.

Edited by Renex, 04 March 2008 - 04:58 AM.


#5 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 04 March 2008 - 05:52 PM

CR = Character Return = \r
LF = Line Feed = \n

So CR+LF is the same as \r\n, which is the Windows default. Which also means that yes, Dreamweaver would support them.

Unfortunately, due to the "universal compatibility" of the web, i doubt much can be done in terms of helping you further with your given examples (unless somebody mysteriously knows more then me right now).

So could you upload the actual .css file here so that we can download it and get a closer look at it (when you make your next post, there is an attachment option, that should work fine).

#6 jbladeus

jbladeus

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 13 March 2008 - 07:07 PM

you could always use wordpad. If you open the same garbled up text file in wordpad, you'll see that it renders quite ok.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users