〖〗@:!/ &amp quot php; _ < > `,·。≈{}~ () _ -『』√ $ @ * & # ※

HTML Named Special Symbols
HTML Named Special Symbols
Characters with Special Meaning in HTML
&&less than
&&greater than
&&ampersand
&&quotation mark
Punctuation
&&non-breaking space: '&'
&&em space: '&'
&&en space: '&'
&&thin space: '&'
&&overbar space
Interesting Characters and Symbols
&D&Ddouble dagger
&&left single quotes
&&right single quotes
''single quotes
☺☺smiley face
★★black star,&& &#x2605
☆☆white star
☐☐check box
&&middle dot
&&copyright
&&registered
&&inverted question mark
&&inverted exclamation mark
&A&AAngstr&m
&&ellipsis
⊕⊕earth
⊙⊙sun
♀♀female
♂♂male
Foreign Characters
&&ligature ae
&&c with cedilla
&&a with circumflex
&&a with acute
&&a with grave
&C&CC with cedilla
&N&Ntilde N
&A&AA with circumflex
&A&AA with acute
&A&AA with grave
&O&OO slash
Card Suits
&&clubs or shamrock &
&&hearts or valentine &
&&diamonds &
Mathematical Symbols
&&less than
&&less than or equal to
&&greater than
&&greater than or equal to
&&not equal
==equal to
&&approximately equal to
&&identically equal to
&&congruent to
&&proportional
∴∴therefore
&&summation
&&prime or minutes
&P&Pdouble prime or seconds
&&integral
&&middle dot
&&dot operator
&&minus sign
&&multipllcation sign
&&division sign
&&fraction slash, (ordinary / \)
&&plus or minus
&&degree sign
&&floor function
&&floor function
&&ceiling function
&&ceiling function
&&asterisk operator, (ordinary *)
&&circled plus
&&circled times
&&masculine ordinal
&&&sub&&&/sub&composition
X&&&span style='text-decoration:overline'&X&/span&&&over bar
&&infinity
½½half
&&perpendicular
&&is an element of
&&not an element of
&&null set
&&subset of
&&subset or or equal to
&&not a subset
&&intersection
&&tilde operator (ordinary ~)
||vertical bar
&O&Oslash O
&&logical and
&L&Llambda (and)
&&logical or
VVvee (or)
&&not sign
&&tilde operator (ordinary ~)
&&right arrow
&rA&rAdouble right arrow
&&left arrow
&lA&lAleft double arrow
&&left right arrow
&hA&hAleft right double arrow
&&down arrow
&dA&dAdown double arrow& *
&&up arrow
&uA&uAup double arrow& *
&&carriage return arrow
&&& *& may be undefined with sans-serif font-family
&&right arrow
&rA&rAdouble right arrow
&&left arrow
&lA&lAleft double arrow
&&left right arrow
&hA&hAleft right double arrow
Greek Alphabet
&&&A&Aalpha
&&&B&Bbeta
&&&G&Ggamma
&&&D&Ddelta
&&&E&Eepsilon
&&&Z&Zzeta
&&&T&Ttheta
&&&I&Iiota
&&&K&Kkappa
&&&L&Llambda
&&ΜΜmu
&&ΝΝnu
&&ΞΞxi
&&&O&Oomicron
&&ΠΠpi
&&&S&Ssigma
&&&U&Uupsilon
&&&O&Oomega温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
HTML特殊转义字符列表最常用的字符实体Character Entities
半方大的空白
全方大的空白
不断行的空白格
已注册商标
商标(美国)
ISO 8859-1 (Latin-1)字符集HTML 4.01 支持 ISO 8859-1 (Latin-1) 字符集。备注:为了方便起见,以下表格中,“实体名称”简称为“名称”,“实体编号”简称为“编号”
数学和希腊字母标志symbols, mathematical symbols, and Greek letters
重要的国际标记markup-significant and internationalization characters
JavaScript转义符
横向跳格 (Ctrl-I)
编程的时候要注意特殊字符的问题,很多运行时出现的问题都是因为特殊字符的出现而引起的。注意,由于反斜杠本身用作转义符,因此不能直接在脚本中键入一个反斜杠。如果要产生一个反斜杠,必须一起键入两个反斜杠 (\\)。 编码转换(to Unicode)(程序代码来源于网络) Js版 &script&     test = &你好abc&     str = &&     for( i=0;    i&test. i++ )     {    
temp = test.charCodeAt(i).toString(16);    
str    += &\\u&+ new Array(5-String(temp).length).join(&0&) +     }     document.write (str)&/script&vbs版Function Unicode(str1)     Dim str,temp     str = &&     For i=1    to len(str1)    
temp = Hex(AscW(Mid(str1,i,1)))    
If len(temp) & 5 Then    temp = right(&0000& & temp, 4)    
str = str & &\u& & temp     Next     Unicode = strEnd Function Function htmlentities(str)     For i = 1 to Len(str)         char = mid(str, i, 1)         If Ascw(char) & 128 then             htmlentities = htmlentities & &&#& & Ascw(char) & &;&         Else             htmlentities = htmlentities & char         End if     NextEnd Function coldfusion版 function nochaoscode(str){     var new_str = “”;     for(i=1; i lte len(str);i=i+1){         if(asc(mid(str,i,1)) lt 128){             new_str = new_str & mid(str,i,1);         }else{             new_str = new_str & “&##” & asc(mid(str,i,1));         }     }     return new_}
附:在php中我们可以用mbstring的mb_convert_encoding函数实现这个正向及反向的转化。 如: mb_convert_encoding (&你好&, &HTML-ENTITIES&, &gb2312&); //输出:你好mb_convert_encoding (&你好&, &gb2312&, &HTML-ENTITIES&); //输出:你好 如果需要对整个页面转化,则只需要在php文件的头部加上这三行代码: mb_internal_encoding(&gb2312&); // 这里的gb2312是你网站原来的编码mb_http_output(&HTML-ENTITIES&);ob_start('mb_output_handler');来源:HTML转义字符: 相关:正则表达式:
阅读(317)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_084071',
blogTitle:'\t\tHTML字符实体(Character Entities),转义字符串(Escape Sequence)(转载)',
blogAbstract:'为什么要用转义字符串?HTML中&,&,&等有特殊含义(&,&,用于链接签,&用于转义),不能直接使用。这些符号是不显示在我们最终看到的网页里的,那如果我们希望在网页中显示这些符号,该怎么办呢?这就要说到HTML转义字符串(Escape Seq\x0Ence)了。'
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}2639人阅读
programming(20)
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:168954次
积分:1991
积分:1991
排名:第15691名
转载:139篇
评论:24条
(1)(3)(3)(2)(3)(12)(1)(1)(1)(1)(7)(2)(11)(5)(32)(24)(4)(3)(23)(3)php - htmlentities() vs. htmlspecialchars() - Stack Overflow
to customize your list.
Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
J it only takes a minute:
What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?
10.6k1373108
4,07631819
From the PHP documentation for :
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
From the PHP documentation for :
Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with some of th the translations made are those most useful for everyday web programming. If you require all HTML character entities to be translated, use htmlentities() instead.
The difference is what gets encoded. The choices are everything (entities) or "special" characters, like ampersand, double and single quotes, less than, and greater than (specialchars).
I prefer to use htmlspecialchars whenever possible.
2,24391636
59.5k81252398
htmlspecialchars may be used:
When there is no need to encode all characters which have their HTML equivalents.
If you know that the page encoding match the text special symbols, why would you use htmlentities? htmlspecialchars is much straightforward, and produce less code to send to the client.
For example:
echo htmlentities('&Il était une fois un être&.');
// Output: &Il &tait une fois un &tre&.
echo htmlspecialchars('&Il était une fois un être&.');
// Output: &Il était une fois un être&.
The second one is shorter, and does not cause any problems if ISO-8859-1 charset is set.
When the data will be processed not only through a browser (to avoid decoding HTML entities),
If the output is XML (see ).
23k1667136
Sometimes you're writing XML data, and you can't use HTML entities in a XML file.
Because htmlentities substitutes more characters than htmlspecialchars. This is unnecessary, makes the PHP script less efficient and the resulting HTML code less readable.
htmlentities is only necessary if your pages use encodings such as ASCII or LATIN-1 instead of UTF-8 and you're handling data with an encoding different from the page's.
68.1k8139174
This is being encoded with htmlentities.
implode( array_values( get_html_translation_table( HTML_ENTITIES ) ), "\t" ):
This is being encoded with htmlspecialchars.
implode( array_values( get_html_translation_table( HTML_SPECIALCHARS ) ), "\t" ):
10.2k1569118
I just found out about the
function. You pass it HTML_ENTITIES or HTML_SPECIALCHARS and it returns an array with the characters that will be encoded and how they will be encoded.
129k22250294
4,07631819
You should use htmlspecialchars($strText, ENT_QUOTES) when you just want your string to be XML and HTML safe:
For example, encode
' to '
However, if you also have additional characters that are
or uncommon symbols in your text then you should use htmlentities() to ensure they show up properly in your HTML page.
' will only be encoded by htmlspecialchars() to ' if the ENT_QUOTES option is passed in. ' is safer to use then & since older versions of Internet&Explorer do not support the & entity.
Technically, & does not need to be encoded as per the XML specification, but it is usually encoded too for consistency with the requirement of & being encoded.
10.6k1373108
htmlspecialchars () does the minimum amount of encoding to ensure that your string is not parsed as HTML. This leaves your string more human-readable than it would be if you used htmlentities () to encode absolutely everything that has an encoding.
You probably want to use some Unicode character encoding, for example , and htmlspecialchars. Because there isn't any need to generate "HTML entities" for "all [the] applicable characters" (that is what htmlentities does according to the documentation) if it's already in your character set.
10.6k1373108
4,18621632
htmlentities — Convert all applicable characters to HTML entities.
htmlspecialchars — Convert special characters to HTML entities.
The translations performed translation characters on the below:
'&' (ampersand) becomes '&'
'"' (double quote) becomes '&' when ENT_NOQUOTES is not set.
"'" (single quote) becomes ''' (or &) only when ENT_QUOTES is set.
'&' (less than) becomes '&'
'>' (greater than) becomes '&'
You can check the following code for more information about what's htmlentities and htmlspecialchars:
5,19311330
1,16211024
One small example, I needed to have 2 client names indexed in a function:
[1] =& Altisoxxce Soluxxons S.à r.l.
[5] =& Joxxson & Joxxson
I originally $term = get_term_by('name', htmlentities($name), 'client'); which resulted in term names that only included the ampersand array item (&) but not the accented item. But when I changed the variable setting to htmlspecialchars both were able to run through the function. Hope this helps!
protected by ♦
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10
on this site (the ).
Would you like to answer one of these
Not the answer you're looking for?
Browse other questions tagged
rev .24625
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 lt gt 的文章

 

随机推荐