Home » Questions » Computers [ Ask a new question ]

Dreamweaver reverts to western encoding after its been changed to UTF8

Dreamweaver reverts to western encoding after its been changed to UTF8

I'm using Dreamweaver CS3, and when I built an application I forgot to ensure that the encoding was set to UTF8.

Asked by: Guest | Views: 21
Total answers/comments: 3
Guest [Entry]

"Files encoded as UTF-8 do not necessarily need any special marker (the so-called byte-order mark, or ""BOM"") to indicate they are encoded as such.

It depends on your settings whether or not Dreamweaver adds such marker. Especially for non-HTML files, it's often recommended not to add such marker for UTF-8 at all. Like a BOM in a CSS file is said to sometimes cause the initial rules in the file to fail in some browsers. And prior to version 6, PHP simply considers the BOM as output, which might yield ""Cannot modify header information - headers already sent"" errors.

Computer programs have a few options to determine the encoding when opening a file that has no marker: scan the first hundred bytes of the document to see what's in there, or (like for XML and HTML files) trust the value of some encoding specified as human readable text in the document. And if all fails: simply use some default when the encoding is not otherwise known.

So, there's a few things to check:

Is a BOM used for the files that Dreamweaver correctly detects as UTF-8, and in the files that it detects as Western? On a Mac, open Terminal and run:

file my-file.html

...which might yield something like:

my-file.html: UTF-8 Unicode (with BOM) text, with CRLF line terminators

On Windows, you could find the same command in Cygwin. Or use a hex-editor to see the first bytes (EF BB BF for a UTF-8 BOM). Or set a browser to explicitly use Western and do a View Source (or use an old editor that does not understand UTF-8) to see if it shows the first bytes as funny characters, such as . That's your UTF-8 BOM then.

(If you find ÿþ or þÿ then it's UTF-16. Bad, unless you're writing something like Chinese! Not seeing any funny characters at all in this answer? Then read about using ""Arial Unicode MS"" at Get Dingbats to appear in Firefox 3?)
Do the internals of the file specify an encoding? Such as:

<meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8""/>

(In HTML files, the Content-Type should be specified before the <title> tag.)
If both are present: do they match?
If Dreamweaver thinks a file is not UTF-8: does it matter? So: are there any special characters in that file? A plain ASCII file does not change when it is saved as UTF-8 (unless a BOM is prefixed).

(Note that I assume you're still working with local files. If things are actually fetched from a web server, then there's also the Content-Type HTTP header. See Firefox displays garbage characters in lieu of web page then. Once you upload your files to a web server, you need to ensure the web server sends the same encoding in its Content-Type headers.)"
Guest [Entry]

"Menu Modify > Page Properties > Encoding and specify the encoding to convert the document to

enjoy!"
Guest [Entry]

"Check out the iconv maybe...

EDIT: I don't know if you tried that iconv yet. Maybe you were too lazy to install cygwin. I found web interface to iconv in that wiki link. Check it out."