开发者

Difference between &and & Character Encoding

I am building a CAML query and some of my values have

"&" which translates to "&" in U2U CAML Builder

However when I try to match the items in 开发者_JAVA百科my list that have "&" it fails.

When I input "&" into the valeus it translates to "&"

What is the difference between "&" and "&" and how in code (vb.net) should I account for the difference?


The character is Unicode U+0026 &​ ampersand (38decimal, HTML: & &), this is inherited from the same value in ASCII. Apart from this, Unicode also has the variants:

* U+FE60 ﹠​ small ampersand (HTML: ﹠ )
* U+FF06 &​ fullwidth ampersand (HTML: & in block Halfwidth and Fullwidth Forms)
* U+214B ⅋​ inverted ampersand (HTML: ⅋ )

info:

http://www.fileformat.info/info/unicode/char/ff06/index.htm

More Information:

http://en.wikipedia.org/wiki/Ampersand

I hope its help to you


I had the same issue right now and after a little research, I found out, that SharePoint saves Taxonomy values with ampersand (&) as fullwidth ampersand (&) (unicode). You can convert your search query values (&) with TaxonomyItem.NormalizeName() in fullwidth ampersand (&) (see https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomyitem.normalizename(v=office.14).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1) and vice versa with string.Normalize() (see Convert fullwidth to halfwidth)

A good article about SharePoint ampersands you can find here:

https://nickhobbs.wordpress.com/2012/03/29/sharepoint-2010-managed-metadata-converts-ampersand-and-double-quotes-to-unicode/


As others have pointed out, & is the character FULLWIDTH AMPERSAND, whereas & is a just plain AMPERSAND. The Unicode database declares these characters to be compatible, which means that if you convert both & and & into the NFKD normal form, you will end up with the same result (specifically, &). If you wish to treat & and & as if they were the same character, perhaps you could find a function that converts your strings into NFKD.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜