zoukankan      html  css  js  c++  java
  • How to Use HTML Codes for Special Characters转载 Anny

    对于一部分直接依赖Ascii的语言,可以通过该语言的字符来产生随机的语言文字。即通过对属于某个语言的字符的拼接,可以产生多语言文字。

    例如:

    case LCID.Greek:
                        charRange = new char[][] {   new char[] { (char)913, (char)969}   //Greek Specific
                                                    };

    以下部分为转载,只要是可以获得对应的特殊字符:

    If you post a Web site in another language, refer to currency that's not on the keyboard, or want to represent more complex mathematical concepts you will need to use special characters. It is often easier to insert and use a special character on a Web page, than to find the actual code to use.

    Follow these simple steps to find the characters you need and add them to your Web pages.

    1. Look up the character you need.
      First you want to look up the character you need to use. If it's a character based on a letter, start with the HTML Codes document, then you can move to the currency codes, mathematics codes, and punctuation codes.

    2. Place the code in your document.
      You can use the friendly name if there is one, the decimal numeric code, or the hexadecimal numeric code. I recommend using the decimal or hexadecimal codes. Not all browsers support the friendly codes, and if you need to load them into XML, the friendly codes will not be supported by most XML namespaces. But the numeric codes are.

      Some of the more common characters used are:

      •   - non-breaking space & nbsp; or & #160; or & #xA0;
      • © - copyright & copy; or & #169; or & #xA9;
      • ™ - trademark & trade; or & #153; or & #x99;
      (Remove the spaces between the & and the entity name or number.)

    3. Add the unicode declaration to your document head.
      Simply add the following meta tag anywhere inside the <head> of your Web page. This will insure that your special characters display correctly.
      <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    4. Always check that you've ended your entity with a semi-colon (;).
      Some HTML editors will allow you to post HTML codes without the final semi-colon, but your pages will be invalid, and many Web browsers won't display the entities correctly without it.

    5. Your entity should also begin with an ampersand (&).
      Many Web editors will let you get away with leaving out the "amp;" when you display an ampersand alone (&), but I don't recommend getting into this habit. When my team switched to XHTML that was our most common validation error - ampersands that were not written as HTML entities with their valid HTML code: &.

    6. Test your pages in as many browsers as you can.
      If the character is crucial to understanding your document, and you can't test it in the browser/OS combinations that your customers use, then you should find another way to represent it. But before you resort to images or something else, you should see if these browser testing tools can help you.

  • 相关阅读:
    C# 打开模态对话框 和打开文件夹
    C# 统计字符串出现的个数
    html table内容不随标题滚动
    log4net 局部代码 看不懂....
    js的replace, 高亮, insertAdjacentHTML , tbody.innerHTML
    python之tkinter使用举例-Button
    使用pygal_maps_world.i18n中数据画各大洲地图
    使用pygal_maps_world展示世界地图
    python之pygal:掷两个不同的骰子并统计大小出现次数
    python之文件目录操作
  • 原文地址:https://www.cnblogs.com/limei/p/1821385.html
Copyright © 2011-2022 走看看