Detect browser character support in javascript?

后端 未结 4 2009
迷失自我
迷失自我 2020-11-28 12:19

I\'m working on a music related website, and frequently use the HTML special characters for sharps (♯) and flats(♭) to keep things pretty, e.g.:



        
4条回答
  •  悲&欢浪女
    2020-11-28 13:02

    "Browser support" is not the problem here. You should be serving your files as UTF-8*, and use the appropriate characters rather than the HTML entities.

    • Unicode sharp symbol: ♯ (U+266F)
    • Unicode flat symbol: ♭ (U+266D)

    You should also make sure to save your files in UTF-8 (and not, say, ASCII or ISO-8859-1).

    See also: the must-be-mentioned Joel on Software: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!).


    *I'm not a Rails guy, but I think it does this by default.

提交回复
热议问题