PDA

View Full Version : HTML editors are breaking my code



schwim
16th September 2006, 02:18 AM
Hi there guys,

I've tried Quanta and Bluefish, and both have given me the same problem.

When editing html or php files, it's adding extra spaces and corrupting characters. I've set both to UTF 8(unicode), but the problem persists.

Now, I really thought that editing files in linux to run on a linux server would be a no brainer, but although I have no problem at all editing in Windows, any time I edit a file on my linux machine, I can count on it being corrupted in some form or another.

Note that I am using the same FTP app to upload whether I'm working on the Windows or Linux machine, so I think we can cross uploading in an incorrect format off of the list of possibilities.

What am I missing?

thanks,
json

Dan
16th September 2006, 04:20 AM
Evenin' schwim.

Glad you're busy. Beats the he** out of sitting here taking drugs and soaking in icewater. :(

No answers here. I got sick of quasi-GUI HTML editors trashing my code a year or two ago. So Nedit and I have gotten to know each other since then. (This likely has more to do with my weird-arsed code rather than the editors.) So I don't have an answer. But I'm gonna keep peeking over your shoulder and see if you get one! :D

Dan

schwim
16th September 2006, 04:27 AM
oh, I'll get one, oh yes, yes indeed... muahhahahahaha!

It will probably be wrong though if it's anything like my answers :)

thanks,
json

Dan
16th September 2006, 04:38 AM
What the he**! They're just electrons. Right or wrong, they'll be equally inconvenienced.

Uhmm... About the laugh... Sounds like it's time to pull that 14 guage black coffee drip... and switch to a tablespoon of Folgers crystals placed directly under the tongue! :eek:

Dan

schwim
16th September 2006, 04:46 AM
but that's where I keep my ephedrine tablets!

:)
json

jvroig
16th September 2006, 04:48 AM
Never used Quanta or anything like it before.

I just use gEdit for PHP. For HTML, gEdit too.

I used to use Crimson Editor for Windows. Very lightweight, extremely fast, packed full of features. Can fit in one 3.5" diskette, and installs in under a minute.

I"ll give it a shot one time though, and see if I get something. Although if it is really a widespread problem, a lot more would be reporting the same thing, so I'm not particularly expecting something wrong to happen though.

schwim
16th September 2006, 04:56 AM
Any help would be greatly appreciated, jrroig. Thanks for taking the time.

thanks,
json

pete_1967
16th September 2006, 11:06 AM
You say you have encoding set to UTF-8 on your Linux editors, how about on your Windows editors?

Also check that both sides use same line endings (either Windows, Unix or Mac).

Last but not least, Windows editors usually add BOM character to the beginning of UTF files that Unix systems don't need resulting to that ugly twiggle showing up in fils, make sure you delete that.

schwim
17th September 2006, 02:08 AM
hehe, my Win editors aren't robust enough for character encoding :)

Let me restate that the only system I'm not having problems with is the Windows system. It's working fine for me. The only one I'm breaking sites with is the linux system.

thanks,
json

Dan
17th September 2006, 06:06 AM
Evening schwin!


...I'm not having problems with is the Windows system. It's working fine for me. The only one I'm breaking sites with is the linux system. Are you allowed to say that here? :eek:

I wonder if it's quotation marks and apostrophies mostly that are getting broken?

Dan

EDIT: And dashes too?

pete_1967
17th September 2006, 11:25 AM
hehe, my Win editors aren't robust enough for character encoding :)

Let me restate that the only system I'm not having problems with is the Windows system. It's working fine for me. The only one I'm breaking sites with is the linux system.

thanks,
json

Well, considering that you are forcing encoding to UTF-8 on Linux, but don't actually know what is the original encoding of those files (most probably ANSI-8591), what do you expect?

Also, if you're using MS Word style 'beautified' quotation marks and long hyphens etc they will break your pages, not only in Linux editors but in browsers as well unless pages are set to Windows character encoding.

Instead of blaming your OS for broken files, look in the mirror and you see the real villain.

schwim
17th September 2006, 02:43 PM
That's why I love you Pete, because you can turn anything into a soap opera :)


The only one I'm breaking sites with is the linux system.


I never said that my Linux system had taken on a clandestine mission to break my files, I said that they were only being broken on the Linux system, which is a factual statement.

All visitors to this forum, unless they ride the short bus, are aware that I am the one who ultimately is responsible for any settings on the computers.

My statement concerning the fact that it wasn't Win but the linux system causing problems, was because comments were being made concerning how illegal characters can show up in win editors.



Instead of blaming your OS for broken files, look in the mirror and you see the real villain.


That was freaking awesome. It's in my "Quote of the day" database now.

thanks,
"The Real Villain"

pete_1967
17th September 2006, 02:59 PM
That's why I love you Pete, because you can turn anything into a soap opera :)


I never said that my Linux system had taken on a clandestine mission to break my files, I said that they were only being broken on the Linux system, which is a factual statement.

All visitors to this forum, unless they ride the short bus, are aware that I am the one who ultimately is responsible for any settings on the computers.

My statement concerning the fact that it wasn't Win but the linux system causing problems, was because comments were being made concerning how illegal characters can show up in win editors.



That was freaking awesome. It's in my "Quote of the day" database now.

thanks,
"The Real Villain"

Well, I could have just said: It's a user error and leave you wondering what you're doing wrong, but if you're not actually interested in possible reasons why those files 'break' after you have modified them in Linux editors...

P.S. That phrase is trademarked, my lawyer will send you the bill for using it.

schwim
17th September 2006, 03:07 PM
Hi there Pete. The Villain here,

My mistaken assumption was that UTF would be the most lax in character allowances, and regardless of what I was opening up, it would be the best to use when not knowing the characterset, but obviously, this wasn't the case.

I've set the encoding to 8859-1, and have opened up a couple of files with good results. I'll use it today(no rest for the wicked), and see how it goes.

Thanks very much for your help, and if your lawyer comes a-knocking, I'm going to tell him that I saw The Villain run by the house and into the woods.... I can do that, because although I are one, I don't look like one :)

thanks,
The Real Villain

pete_1967
17th September 2006, 04:10 PM
My mistaken assumption was that UTF would be the most lax in character allowances, and regardless of what I was opening up, it would be the best to use when not knowing the characterset, but obviously, this wasn't the case.


UTF-8 is 'safest' encoding method when you need to deal with multi-lingual, or languages outside common ANSI character sets but your problem wasn't so much about using UTF in Linux than using UTF on files that were then displayed in (encoding set to) ANSI when you deployed them.

On rare cases UTF doesn't have characters (like those pesky MS Word chars) it can display, and you can safely open ANSI encoded files and save them in UTF (most times) without problems, you just need to remember that it doesn't go other way: if you then try to display UTF file in ANSI, it will break (unless you only have first 255 charcters in document) because UTF codes go outside ANSI's range.

Dan
17th September 2006, 10:20 PM
Hmmm.

Checked the mirror here too. Has to be faulty encoding in the glass. You wouldn't believe what I saw staring back at me! :eek:

Thanks for the answers.

Dan

schwim
18th September 2006, 01:55 AM
Hi there Pete, and thanks very much for the awesome explanation.

To be honest, I was completely ignorant of the fact that it was a one-way street, and it would explain my problems. Well, my problems with saving the files anyways.

If it doesn't end up fixing the problem, I'm coming back to blame Linus Torvalds.

thanks,
The Villain Formerly Known As Schwim