homepage Welcome to WebmasterWorld Guest from 54.163.139.36
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Notepad
carriage returns?
bsim

5+ Year Member



 
Msg#: 3857147 posted 1:33 am on Feb 25, 2009 (gmt 0)

I create my web pages in Dreamweaver on an Intel Mac. Pull the files to my PC for viewing in IE 7. Any minor adjustments I make using Notepad, save and put back on the Mac. I view the Notepad files fine on the PC and Dreamweaver opens them without a problem - been doing this over a year.
Now I have a client who works on the pages making a small adjustment to the quantity of a product - page is fine (online and View Source through IE is correct), but when I download and view on Notepad I have scrambled characters - am assuming are carriage returns.

At first I thought it was the client using something different to open. Then I tested my own pages and found the same to be true.

While I CAN correct this by opening in Word, Save As and then return to Notepad - I would like to gain some understanding of "why".

Does it have to do with Dreamweaver setting the "charset=UTF-8" (see below). If so, is this what I want, or should I change this preference? It views fine in IE on PCS and on Macs through Safari and Firefox. Thanks.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 

bsim

5+ Year Member



 
Msg#: 3857147 posted 1:35 am on Feb 25, 2009 (gmt 0)

I forgot to clarify: I get the screwy notepad when I download my own pages via ftp , otherwise they are fine on my hard drive. NOT after I download them.

lavazza

5+ Year Member



 
Msg#: 3857147 posted 1:46 am on Feb 25, 2009 (gmt 0)

One possible solution

When saving files, set the Encoding to UTF-8 rather than ANSI

see:
ANSI, Unicode, UTF-8, and the path of most resistance!
Advanced Unicode Questions
[webmasterworld.com...]

SteveWh

5+ Year Member



 
Msg#: 3857147 posted 2:40 am on Feb 25, 2009 (gmt 0)

If the lines are all run together (no line breaks) and there are little squares where the linebreaks should be, it probably is due to different line end characters. This isn't due to differences in the charset encoding of the HTML file, but to differences in how different operating systems save linebreaks in text files.

Notepad and Windows use CRLF. I think Linux uses just LF, and I think Mac uses just CR (though I'm less sure of that one).

Word sometimes takes liberties with files being saved, especially HTML, so I wouldn't trust it with that task.

However, you can accomplish the same thing by opening the file in WordPad and saving it. WordPad is less likely to do other weird things to the file.

[edited by: SteveWh at 2:41 am (utc) on Feb. 25, 2009]

bsim

5+ Year Member



 
Msg#: 3857147 posted 3:00 am on Feb 25, 2009 (gmt 0)

This makes sense to me as it appears to be what is happening. Once I open in Wordpad (I know not to use Word) and save as a text file html extension It appears normal in Notepad.

All that said would I be better off using BBedit or some other text editor in Windows other than Notepad? Since the code is coming from Dreamweaver will I always have an issue between the two operating systems?
Thanks, agian

swa66

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3857147 posted 9:21 am on Feb 25, 2009 (gmt 0)

Also take a look at your ftp clients: they should be able to translate text files like css and html to have the right CR/LF combo on the other side if the transfer is done in ASCII mode vs. BINARY.

Obviously you do not want that ASCII mode for a gif, joeg or png, but you might want it for html.

choster

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3857147 posted 4:26 pm on Feb 26, 2009 (gmt 0)

There's nothing inherently wrong with Notepad or Wordpad, but for editing code you probably want something with syntax highlighting, like Notepad++ or Textpad.

Some background on line termination can be found at [blogs.msdn.com...] .

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3857147 posted 4:36 pm on Feb 26, 2009 (gmt 0)

Many HTML editors have the option to save files with the various line-enders used by Windows and *nix (including Macs). When saving as text files, MS Word also has (or had -- I'm not sure about the most recent versions) the capability to use various line-enders.

Jim

daveginorge

5+ Year Member



 
Msg#: 3857147 posted 7:50 pm on Feb 26, 2009 (gmt 0)

Download Notepad++ it's a fantastic little editor designed for programmers, it also automatically handels the unix end of line character which I suspect what your problem is.
[notepad-plus.sourceforge.net ]

Remember to select the current programming language you are using under the menu entry "Language"

Dave

bsim

5+ Year Member



 
Msg#: 3857147 posted 9:04 pm on Feb 26, 2009 (gmt 0)

It is still odd:
I create in Dreamweaver UTF-8 charset - pull to PC, view the file in IE7, view the Notepad code - NO change to code, upload, then download and view the code. (Upload ASCII and download same)

I now see all the screwy carriage returns, again. I have used 2 different ftp programs with the same results.

At this point, just hoping to know the "why".
Thanks, again

pinterface

5+ Year Member



 
Msg#: 3857147 posted 11:47 pm on Feb 26, 2009 (gmt 0)

ASCII transfer mode requires the server and client both know what their proper line endings are, and if either one is wrong, hoo-boy! That said, most any editor other than Notepad can handle the various types of line endings without difficulty, so if ASCII transfer mode is causing problems, why not use BINARY for everything?

vikrantkpr

5+ Year Member



 
Msg#: 3857147 posted 8:20 pm on Mar 5, 2009 (gmt 0)

I use Free product from Microsoft :-V isual Web Developer, works good, can view online files, edit them, all fine.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved