Jump to content

Special character display issue


son

Recommended Posts

I have a problem with German special characters and hope someone is able to help...Each php page on this website has the following at the top:

<?php$pagePhoto = "angebot";include_once('inc/header.php');?><h1>heading</h1>

The include file starts with:

<?phpheader('Content-Type: text/html;charset=utf-8');mysqli_set_charset($dbc, 'utf8');?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">

The problem now comes with the following:

<ul><li><a href="sanfte-ganzkoerper-gymnastik.php" title="Sanfte Ganzkörpergymnastik 60+">Sanfte Ganzkörpergymnastik 60+</a></li></ul>

Placed in some web pages the German special characters display ok, in others it does not (even copied from files that work). As all files use same header and code is copied and therefore exactly the same as working examples: does this make any sense? I really do not understand...Any hints appreciated.Son

Link to comment
Share on other sites

You need to make sure the PHP file itself is encoded as UTF-8. The files where the characters display properly are properly UTF-8 encoded.To find out if a file is UTF-8 encoded, and convert it to one if it itsn't, open it with Notepad, and open the "File > Save As..." dialog. See what's in the "Encoding" dropdown menu. If it's "UTF-8", the file is UTF-8 encoded already. If it's not, change the dropdown to UTF-8, and save the file. The newly saved file would then be UTF-8 encoded.The function wirehopper points you to is useful if you must encode content from a non UTF-8 source (e.g. one of those badly saved files) into UTF-8, but if you just do the procedure above, you won't need to use it.

Link to comment
Share on other sites

Thanks to both of you. The save as solved the issue. However, will have a read on suggested page also... Seems that Dreamweaver for some reason choose to encode the problematic files different from the other ones... Son

Link to comment
Share on other sites

You can change Dreamwaver's default settings from "Edit > Preferences..." and in the new dialog, from the left "New Document". On the right, change the "Default encoding" dropdown to UTF-8.You can also modify existing file's contents from "Modify > Page Properties...". From the left, "Title/Encoding". Change the "Encoding" dropdown to UTF-8, and hit "Reload" to save the file as UTF-8.

Link to comment
Share on other sites

  • 1 month later...
You can change Dreamwaver's default settings from "Edit > Preferences..." and in the new dialog, from the left "New Document". On the right, change the "Default encoding" dropdown to UTF-8.You can also modify existing file's contents from "Modify > Page Properties...". From the left, "Title/Encoding". Change the "Encoding" dropdown to UTF-8, and hit "Reload" to save the file as UTF-8.
Thanks Boen_robot, but those things were setup correctly from day one... This makes it even more confusing. Could be a bug I suppose, but am not sure...SonBy the way, just to say: sorry for getting back so late. Cought (again) a nasty something that took ages to fade away (and so does my money;-)
Link to comment
Share on other sites

Dreamwaver's default settings apply only when the document was created in Dreamwaver. If not, the specified encoding in the file (which may not be UTF-8) is used. The second setting needs to be used when editing documents created in another editor.I'm guessing even though the settings were right from day 1, you didn't created those PHP files in Dreamwaver, but only lastly edited them there, correct?

Link to comment
Share on other sites

Dreamwaver's default settings apply only when the document was created in Dreamwaver. If not, the specified encoding in the file (which may not be UTF-8) is used. The second setting needs to be used when editing documents created in another editor.I'm guessing even though the settings were right from day 1, you didn't created those PHP files in Dreamwaver, but only lastly edited them there, correct?
Hi boen_robot,This is neither the case. I create all of my pages with Dreamweaver right from day one... Strange, isn't it? I have quite a lot of issues in general with display of special characters. Please also see my thread http://w3schools.invisionzone.com/index.php?showtopic=33904 with another issue with the display of special characters from a database if that might be relevant to this thread. For the other issue it is ok when I have the special characters directly in the HTML code, but when I retrieve the same strings from database it does not display (so in this case file is saved correctly as UTF-8 and all that, but the database retrieval or storage causes issues).I simply do not understand all those issues cropping up. I am not sure what I am missing....Son
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...