3

the caml query bellow don't return the correct result :

<Where><Eq><FieldRef Name='ParentLink' /><Value Type='Text'>ⵜⴰⵎⴰⵡⴰⵙⵜ</Value></Eq> </Where> 

i think the problem is due to the unicode charchter that i use to search. there is a solution to escape it ?

2 Answers 2

4

You need to surround the data with a CDATA tag:

<Value Type="Text"><![CDATA["ⵜⴰⵎⴰⵡⴰⵙⵜ"]]></Value> 
2
  • Hello thank you for answering, Unfortunately CDATA tag does'nt resolve my problem. string caml = @"<Where><Eq><FieldRef Name='ParentLink' /><Value Type='Text'><![CDATA[ⵜⴰⵎⴰⵡⴰⵙⵜ]]></Value></Eq></Where>"; i note that my text is in Tifinagh. Thanks. Commented Aug 23, 2013 at 14:30
  • You have to use quotes too, per the example. Commented Aug 23, 2013 at 18:50
0

Try encoding the given string before passing it to the CAML query:

string EncodeForCAML(string s) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.Length; ++i) { char ch = s[i]; if (char.IsLetterOrDigit(ch)) sb.Append(ch); else sb.AppendFormat("&#{0};", Convert.ToInt32(ch)); } return sb.ToString(); } 

SOURCE

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.