Results 1 to 4 of 4

Thread: UTF-8 and special characters.

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default UTF-8 and special characters.

    Hi all,

    Just a few simple questions about UTF-8 and special characters:

    1. When using UTF-8 and XHTML/HTML, is it required that you use a character code to display a special character, or can you just write the plaintext special character? For instance, a small "A" with an accent is "U+00E1" in Unicode and "á" in HTML.

    2. If you can just write the plaintext character with UTF-8 encoding, must the server also be configured to support this?

    My situation:

    All my pages are UTF-8. In HTML, I must use the HTML escape code or I get the question-mark-in-diamond symbol in Firefox. In Javascript, I must use the UTF-8 escape code or I get the same diamond question mark.

    I turned to Google, but found confusing answers. A common answer I found to any sort of special character problem was to simply switch your document to UTF-8 encoding and that all your special characters would render properly, but that is clearly not the case as my situation seems to be the opposite. That's why I ask if there is a matching server setting for other languages.
    Last edited by jlizarraga; 01-15-2009 at 12:54 AM. Reason: resolved

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If they truly are in UTF-8, then you can type the character directly. You can use the HTML entity in any encoding, since they correspond directly to Unicode code points.

    If you're having issues, there are two things to check: 1) that your server is sending the correct character set in the Content-Type header (if you don't know how to check, post a link and I'll look), and 2) that your editor is really saving your files in UTF-8.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Thanks for responding! Here is a great example:

    http://redesign1.autofusion.com/espa...eoverview.html

    - I have Dreamweaver set to UTF-8.
    - "charset=utf-8" is in the markup.
    - Firefox's Page Info window shows the encoding as "UTF-8".
    - The page gets some special characters right, others get question marks.

    The only clue I have is that the area with the question marks is included with PHP like this:

    <?php include "someFile.html" ?>

    The file being included is just stripped out HTML, it doesn't have its own header and body and what not - could that be part of the problem?

  4. #4
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Derp. That was the problem!

    Fixed by adding the charset thinger to the file being included:

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

Bookmarks

Posting Permissions

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