Results 1 to 8 of 8

Thread: Special characters in text don't display

  1. #1
    Join Date
    Feb 2006
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Special characters in text don't display

    Hey guys, I have an issue on my website that I'm making. Certain characters aren't displayed correctly and come up as question marks. Like "" (quotes) and (c) (copyright symbol) and what not. I am using Arial font. The page is saved as php but it's mostly html. I just use php for the include statements.

    Here's a link:
    http://www.istarjrconsulting.com/leadership_team.php
    Last edited by Doomtomb; 04-19-2010 at 05:49 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There are a few reasons for this. All of them relate to character encoding. Basically using all the 1s and 0s, there are many ways to represent a certain character. Different encodings are different systems for this.
    So, explain exactly how you created these pages and the text, what programs, whether you cut/paste, etc. Is the text stored in a database? What format is the database in?

    The easy answer may be to change the encoding of the HTML document itself, but this can also be generated from (for example) saving an HTML file from an MS Word document, or even in some cases just cutting and pasting from Word.

    The complexity here is that without being able to play with the page it's hard to guess why this happens. Additionally, it could even be that it works on some systems and not others. This happens with unusual characters, but not normal punctuation, so it's likely an encoding issue, not a missing font, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    Doomtomb (04-19-2010)

  4. #3
    Join Date
    Feb 2006
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    There are a few reasons for this. All of them relate to character encoding. Basically using all the 1s and 0s, there are many ways to represent a certain character. Different encodings are different systems for this.
    So, explain exactly how you created these pages and the text, what programs, whether you cut/paste, etc. Is the text stored in a database? What format is the database in?

    The easy answer may be to change the encoding of the HTML document itself, but this can also be generated from (for example) saving an HTML file from an MS Word document, or even in some cases just cutting and pasting from Word.

    The complexity here is that without being able to play with the page it's hard to guess why this happens. Additionally, it could even be that it works on some systems and not others. This happens with unusual characters, but not normal punctuation, so it's likely an encoding issue, not a missing font, etc.
    Ok, I gave you a big thank you for this post. Alright, so it has to do with the encoding. I saved this page in Notepad++ as a .php. Then I uploaded it to the server via FTP. How do I change the encoding and which encoding should I use?

    I paused while writing this post, I went into my file editor on the web host and saved it as utf-8 encoding and it works now. I never knew this bit about encodings. My only question is how do I save my files in Notepad++ with the correct encoding? In this case utf-8.

    EDIT:
    Ok, I found it was right in front of my face in an option called "Encoding" on the top bar. I'll call this case solved now.

  5. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There can be varied encodings at any level and this is a real problem. The file itself is encoded in one, the HTML document has a tag that specifics an encoding (if you choose, or the browser's default is used), the text in a database is encoded, and the original text that you cut and paste or type is encoded in something too. To avoid errors, they all must match.
    I use UTF8 because I don't work with just English. Any consistent format should be fine, though UTF8 is the most compatible with all characters. It's said to be slow or something, but I don't really mind.

    That all said, now all you need to do is figure out how to, at every point in the process, control the format.

    I don't use notepad++, but if it's similar to notepad, there will just be a dropdown menu while you save the file (like when you choose a format of .doc, .rtf or .txt in Word), and you can pick UTF8 and other things. (Note: UTF8 is called Unicode sometimes, so that should work too. UTF8 = 8 bit unicode; 16 also exists, though it's less common.)

    You should be able to search google/the help menu for it-- notepad++ is a good program. It should have this feature.
    However some programs actually just don't have an option-- I never did find it in dreamweaver (though I was using an old version, but after installing a demo of the new one I didn't find it either). For this reason I ended up not using it any more and now I just use a simpler program that I actually like better overall, but that was the main reason to change it.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You may be better off (e.g., if you ever start working with .htaccess) selecting the option "UTF-8 without BOM". But for most applications, it won't matter. Make sure your html charset declaration matches whatever you choose.

    djr: you should give notepad++ a try. lotsa cool features, not the least of which is syntax highlighting. Eliminates a LOT of simple mistakes.

  7. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I am on a mac so I can't use notepad++, but I use text wrangler which is about the same from what I can tell. It's nice to work with.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    hmm... Apparently it can run on OSX using a windows emulator of some sort (and although I don't really liking Mac, I think that running Windows on a Mac is completely ridiculous). And if you already have something with similar functionality, cool.

    BTW I also found this, thought it funny
    Quote Originally Posted by notepad++
    Why notepad++ doesn't (and never will) work on Linux

  9. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can run anything with an emulator of course, but it is always very slow. With parallels and such now it's possible to run things near-natively, but I'm not sure of the point of that. Though in the case of a text editor, it doesn't really matter how slowly it's running, though I imagine even that would manage to crash the older forms of virtual pc and whatnot, running on borrowed ram, a file acting as a disc and other nonsense
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •