I know how to escape hash(#) symbol in kendo grid client template like this:-
\\#
But when I am trying to escape a hash in kendo nested grid it is not working probably because \# has special meaing in nested grid. But how can I escape it?
I tried \\\\#, \\#\\#,\\## but nothing worked. Has anyone faced such scenario?
You can make it work if you do
\\\\\\#
that is:
\\\\ is for the backslashes, because the template is treated as javascript, this will be truncated to \\. but for the reason that the # would also be interpreted as binding, you have to escape it separatley to \\#.
after the template is interpreted, the detailview will interpret \\# and your link or whatever you have that requires that escaping, will have the correct value.
Related
I have just installed CK Editor onto a form that submits data to a database, when I want to use an apostrophe ' It is displaying as & #39; on my web page instead.
How can I get it to display an apostrophe instead?
What's happening is that somewhere along the line, CKEditor (or maybe another part of the system) is going through and converting characters that might potentially cause problems (due to having special meaning in HTML) into their HTML entity representations.
This is normal behaviour and if you don't need to do any string manipulation inside your database you can happily leave it as is for that stage. Indeed you can have them in along with normal HTML text and it should render just fine.
Clearly your setup is sufficiently different that something isn't happening. So, you'll want to use something like PHP's html_entity_decode() to convert back to normal unescaped text. There should be an equivalent function available in any language with a half-decent standard library.
Hi I am using Watir to click through some links. I go to a page, click a link based on its text, and the do it again click a new link. I am locating the links based on their text (it is the only way I can based on their HTML) and need to match the text I pulled from the page to the link. The text that I get contains some extra text not part of the link, so I need to gsub it out. Here is my issue:
String: text = "Nuclear Launch Codes (Levels One/Two)"
Link: Nuclear Launch Codes (Levels One/Two) Blah Blah Blah
Because the links do not always have the exact text I need to locate them like so: /#{text}/
Problem is that returns "Nuclear Launch Codes (Levels One\/Two)"
I though I would gsub the 1st parenthesis and everything after, but I need to keep it because I can have Nuclear Launch Codes (Levels Four/Five)
Is there anyway to modify the string to match the link while ignoring the rest of the link text?
If I understand you correctly, try:
/#{Regexp.escape(text)}/
Or equivalently, if you prefer:
Regexp.new(Regexp.escape(text))
This will automatically escape parentheses, slashes and so on in the text so they are not treated as special regexp characters.
So I have a shortcodes system, i.e
[foo bar=1 foobar="2"]
Which will be edited via ckeditor.
How do I prevent CKeditor from escaping any entities within "[" and "]" ?
i.e, quotes resulting in ", spaces resulting in " ", as the result can be
[foo bar=1 foobar="2"]
Which naturally breaks the shortcode.
http://jsfiddle.net/h8wmbnn3/
Like most of my answers nowdays... Can you post- and preprocess the content? If so that that string could be represented by a widget instead! It sounds like a really good fit for one.
So before loading content into CKE, convert for example [foo x="1" y=2] to <div class="mywidget" data-type="foo" data-x="1" data-y="2">[something]</div>. Then you will have your own custom made widget that, if necessary, can edit the X and Y and whatever else needs editing. Then after getting content from CKE / before saving it, convert $('.mywidget') back to a string!
I'm using the Telerik Testing Tools. My goal is to wait for an anchor to make it to the screen, then click on it. The anchor has an href of #resources/details?mode=view&resourceId=149176
I'm having problems escaping that string properly. This code works perfectly:
ActiveBrowser.WaitForElement(5000, "href=~resourceId=149176")
.As<HtmlAnchor>().Click();
Unfortunately, when I try to incorporate more of the url, it breaks, ie, this does not work
ActiveBrowser.WaitForElement(5000, "href=~view&resourceId=149176")
.As<HtmlAnchor>().Click();
It seems as though the & is the problem. I've tried escaping it with everything I can think of based on Telerik's documentation on find expressions, including \ \' and =.
What is the proper way to escape this string?
I believe that you can use & for this one.
I dont want the ckeditor to escape text written. I use the editor such that customers can write their their own mailtemplates, and I give them code snippets they can paste in the around in the text in the editor to merge in dynamic data, ala ${customer.name}.
The text is then persisted to database and retrieved again other places in code and filled with data through Freemarker. And here the problem amerge - Freemarker uses < and > characters, but the ckeditor escapes them. How can I configure ckeditor to not do this?
thanks in advance
CKeditor is creating HTML, so the < and > characters are reserved, and if it wasn't escaping them, the text wouldn't display.
Personally, I would put a translator between what the browser sends to the server and what is being sent to FreeMarker, either when the template is stored, or when it's rendered. If your users are familiar with FreeMarker, continue to allow them to use > and <, but then unescape them before trying to render them.