How can I properly display German characters in HTML?

后端 未结 9 1975
悲&欢浪女
悲&欢浪女 2020-11-29 06:40

My pages contain German characters and I have typed the text in between the HTML tag, but the browser views some characters differently. Do I need to include anything in HT

相关标签:
9条回答
  • 2020-11-29 06:54

    you may try utf8_encode() or utf8_decode() functions.Check if any of these works.

    For example <?php echo utf8_encode('ausgefüllt'); ?>

    Hope it will work.

    0 讨论(0)
  • 2020-11-29 06:55

    Sounds like a character encoding issue, in that the file is saved as a different character encoding to what the webserver is saying it is.

    0 讨论(0)
  • 2020-11-29 07:00

    UTF-8 is your friend.

    Try

    <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
    

    and check which encoding your webserver sends in the header.

    If you use PHP, you can send your own headers in this way (you have to put this before any other output):

    <?php header('Content-Type: text/html; charset=utf-8'); ?>
    

    Also doublecheck that you saved your document in UTF-8.

    0 讨论(0)
  • 2020-11-29 07:04

    Have you tried &uuml; (ü) and &Uuml; (Ü)?

    You can find how to type other letters here.

    0 讨论(0)
  • 2020-11-29 07:04

    I don't like the use of HTML entities (like %uuml;), they are only needed when there is something wrong with your characterset.

    In short:

    The RIGHT way is to fix your characterset.

    The EASY way is to just use entities. You may not ever see any problems with this.

    Tracking down characterset error can be very difficult. If you give us an URL where we can see the problem, we can probably give you a good hint where to look.

    0 讨论(0)
  • 2020-11-29 07:05

    Try the solution in blog post German characters encoding issue (2012-05-10):

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
    
    0 讨论(0)
提交回复
热议问题