当前位置: 动力学知识库 > 问答 > 编程问答 >

html - European Characters are not displayed

问题描述:

I have some issues with displaying European characters

Here is my Code:

<!DOCTYPE html>

<html lang="de">

<head>

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

<title>Image2Food -

Sag mir, was ich daraus kochen kann - Index

</title>

<meta name="viewport" content="width=device-width; initial-scale=1.0">

</head>

<body>

<div id="nav">

<?php

require("nav.php")

?>

</div>

<div id="content">

<h1>Image2Food - Sag mir, was ich daraus kochen kann</h1>

<h2>Das soziale, multimediale Netzwerk für Kochideen</h2>

On Main page the letter "ü", "ä" and "ö" are diplayed as "?". I can not explain why.

网友答案:

In your document you are declaring the UTF-8 character encoding (good idea). For this to work the editor/viewer you are using to edit the file must also be in UTF-8 mode.

If, for example, your editor was in "ANSI" (latin-1 or CP1252) mode, then they would look fine in your editor, but when the browser, in UTF-8 mode, tries to interpret those bytes they will look like invalid byte sequences.

If your editor does not support UTF-8 mode or this is not practical for some reason, use numeric character entities. For example, ü is &#x00FC;. You can use this tool to convert. Paste the sentence into the top box, and then press convert above the box, then look into the box that says "Hex NCRs".

网友答案:

I solved it this way:

<?php
/**
* Festlegung der Untergrenze für die PHP-Version
*@version: 1.0
*/
if (0 > version_compare(PHP_VERSION, '5')) {
die('<h1>Für diese Anwendung '.
'ist mindestens PHP 5 notwendig</h1>');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
 <meta http-equiv="content-type" content="text/html" />
<title>Image2Food - 
Sag mir, was ich daraus kochen kann - Index
</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
</head>
<body>
<div id="nav">
<?php
require("nav.php")
?>
</div>
<div id="content">
<?php
网友答案:

Try this:

it looks like you using German language in your some part of html I would suggest you to add below tag where ever you would like to use German language.

<blockquote lang="de">


</blockquote>

for example :

<!DOCTYPE html>
    <html lang="de">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Image2Food - 
    Sag mir, was ich daraus kochen kann - Index
    </title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0">
    </head>
    <body>
    <div id="nav">
    <?php
    require("nav.php")
    ?>
    </div>
    <div id="content">
    <blockquote lang="de">
    <h1>Image2Food - Sag mir, was ich daraus kochen kann</h1>
    <h2>Das soziale, multimediale Netzwerk für Kochideen</h2>
    </blockquote>
分享给朋友:
您可能感兴趣的文章:
随机阅读: