dcsimg
www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Basic encoding problem

  1. #1
    Join Date
    Jun 2010
    Posts
    65

    Basic encoding problem

    Hi guys

    I'm working on someones page and im just updating it. Now the page is very old and is using old html 4 coding.

    I am adding some content within the <p> tags and its giving question marks for every quotation mark. Now I know that you need html codes for each one but i never have this problem on my sites?

    I started of by changing the doctype to XHTML transitional, but that didnt change anything, then I added
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> instead of <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    but it still does it.

    Am I missing something or should i be replacing all quotation marks with html codes?

    Cheers
    Last edited by jason87; 06-14-2010 at 11:27 AM.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Use a charset that is appropriate for your language, probably ISO-8859-1
    Don't forget to check the headers in case the server is sending a different value.
    The editor, the server, the browser, and the font-family all have to have the support for the charset and special characters used.
    Last edited by Fang; 06-14-2010 at 11:32 AM.

  3. #3
    Join Date
    Sep 2008
    Posts
    408
    Should be replacing them. The quotes are most likely Windows quotes. Guessing the look angled?

  4. #4
    Join Date
    Jun 2010
    Posts
    65
    Well its all done in Dreamweaver at the moment, and the browsers are new. So that just leaves out the server.

    I will try ISO-8859-1, I thought utf-8 was the standard?

    Cheers

  5. #5
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by jason87 View Post
    I'm working on someones page and im just updating it. Now the page is very old and is using old html 4 coding.
    You don't need to update anything. HTML 4.01 is not old. HTML 4.01 strict Doctype and coding are as good as XHTML Doctype and coding. XHTML is not the new version of HTML 4.01, it is just a HTML 4.01 adapted to handle XML objects, codes and files. The new version of HTML would be HTML 5, but this is not yet (or incomplete) implemented in all the browsers. HTML 5 will make HTML/XHTML Doctypes useless, as the coder will be able to use either HTML style coding or XHTML style coding on his will.

    Regarding the charset. It is true that UTF-8 is recommended instead of latin 1 (ISO-8859-1), but if your pages were written in ISO-8859-1, changing the special characters in order to fit the UTF-8 would be an awfully find/replace job. ISO-8859-1 remains still a valid charset, thus I don't think you need to change it by all means.


    Post a link to that site, and I will tell you how old is your code and what you might need to make it up-to-date.
    Last edited by Kor; 06-15-2010 at 05:56 AM.

  6. #6
    Join Date
    Jun 2010
    Posts
    65
    Thanks for that kor.
    Its in your inbox, I'm just going through the w3c validator, if i still get question marks il use the HTML codes instead.
    Whether its the latin char or the utf8 i still get the ?
    Last edited by jason87; 06-15-2010 at 06:44 AM.

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The server is sending UTF-8, so using the meta tag with ISO-8859-1 is pointless.
    The browser will use the server header and ignore the meta tag.
    The same is true of using xhtml while the server sends it as html.

    Change the apostrophes to the ascii value (used on the keyboard) rather than a probable cut & paste from a Word document. A dedicated html editor will have an option to convert these special characters.

  8. #8
    Join Date
    Jun 2010
    Posts
    65
    OK thanks guys
    The problem was that it was copied straight from word.
    Is there a quick way to convert these to normal punctuation marks in dreamweaver or do I have to go through them one by one?

    Thanks

  9. #9
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    I believe Dreamweaver has an option to save the document in a specific charset.
    As the server is sending UTF-8, use this, and change the meta tag to the same.

  10. #10
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by Fang View Post
    The server is sending UTF-8, so using the meta tag with ISO-8859-1 is pointless.
    I suspect rather that the server is sending latin 1 (ISO-8859-1). I had a similar problem lately. I had to switch data written in latin 1 from an old ACCESS MDB to a MySQL DB. I could not use UTF-8 (text was in French), thus I leave it latin 1 and I was forced to use ISO-8859-1 charset in my web document as well. It is true that I had some difficulties to query the DB (AJAX - php/MySQL) but I used utf8_encode(), utf8_decode() [and json_encode()] PHP methods to pass the special characters.
    Last edited by Kor; 06-15-2010 at 07:22 AM.

  11. #11
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    I suspect rather that the server is sending latin 1 (ISO-8859-1).
    The headers show UTF-8

  12. #12
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Well, if you paste the text in the Design Window of DW, it does not matters which charset code is used. But if you paste the text straight into the Code Window, it matters.

    For instance: I copy/paste fran&#231;ais soci&#233;t&#233; in the Design Window. The text will be automatically parsed as fran&ccedil;ais soci&eacute;t&eacute; in the Code Window.

    I guess you must change the default encoding in the Preferences of DW as well: Preferences->New Document->Default encoding
    Last edited by Kor; 06-15-2010 at 07:46 AM.

  13. #13
    Join Date
    Jun 2010
    Posts
    65
    Yeah its not doing it now, even if i copy it straight into the code window. Something I changed must have fixed it.

  14. #14
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    post here a part of that text and let us do some tests as well

  15. #15
    Join Date
    Jun 2010
    Posts
    65
    Quote Originally Posted by Kor View Post
    post here a part of that text and let us do some tests as well
    all i did was validate it and add utf-8 as a charset.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles