escaping

Encoded URL with square brackets. Different behaviour in Chrome/Firefox/IE

痞子三分冷 提交于 2019-12-05 02:42:12
I have a link looking like this (it's a bit ugly because it is URL ) <a href="/items?fc%5B%5D=12345&fc%5B%5D=56789&utf8=%E2%9C%93">foo</a> To be a bit clear, it is URL encoded and translates to <a href="/items?fc[]=12345&fc[]=56789&utf8=✓">foo</a> When the form is submitted, the destination URL looks different in different browsers: In Firefox, it looks like desired: http://mydomain/items?fc[]=12345&fc[]=56789&utf8=✓ In Chrome, the square brackets are shown URL-encoded, (which gives very ugly and non-professional looking addresses when using many of them). http://mydomain/items?fc%5B%5D=12345

Does the img tag's alt attribute require encoding?

梦想与她 提交于 2019-12-05 02:26:57
In html does the text inside the img tag's alt attribute require encoding/escaping? Non encoded example: <img src="myimg.png" alt="image description" /> Encoded example: <img src="myimg.png" alt="image%20description" /> Josh Stodola No, it does not need to be encoded like a URI. However, HTML characters must be encoded, like this... <img src="myimg.png" alt="Me & my image" /> They do not require URL encoding, but they do require, as all XHTML attributes do, XHTML entity encoding. Incorrect: <img src="foo.gif" alt="Ben & Jerry's" /> Correct: <img src="foo.gif" alt="Ben & Jerry's" /> You would

How do you correctly escape a document name in .NET?

China☆狼群 提交于 2019-12-05 02:07:59
We store a bunch of weird document names on our web server (people upload them) that have various characters like spaces, ampersands, etc. When we generate links to these documents, we need to escape them so the server can look up the file by its raw name in the database. However, none of the built in .NET escape functions will work correctly in all cases. Take the document Hello#There.docx : UrlEncode will handle this correctly: HttpUtility.UrlEncode("Hello#There"); "Hello%23There" However, UrlEncode will not handle Hello There.docx correctly: HttpUtility.UrlEncode("Hello There.docx"); "Hello

Escape a string (add slashes) in VB.net?

风格不统一 提交于 2019-12-05 01:52:37
Very simple question (surprisingly I can't find a similar question anywhere): how do I escape form data in VB.net? I have various lines like this: Dim query As String = "exec sp_Message_insert @clientid='" + pClientId + "', @message='" + pMessage + "', @takenby='" + pUserId + "', @recipients='" + pRecipients + "'" If I use an apostrophe in the message then of course this screws up the query. I've looked through the intellisense functions on the string but don't see anything appropriate... What exactly do you mean by escaping? VB.NET doesn't have 'escaping' in the same way that c-style

At witt's end… Javascript won't replace '\\n'!

落爺英雄遲暮 提交于 2019-12-05 01:36:50
I've been going at this problem for a solid couple hours now and having zero luck. No clue how this is even possible; I'll try to summarize. I'm using TinyMCE to insert new content to a DB, that content is being sent back as an AJAX response after it is inserted into the DB and then shown on the page, replacing some old content. All of that isn't really relevant (as far as I can tell) to the problem, but it serves as a background to the problem. Anyhow, the response text has '\n' appropriately wherever the content had line breaks. I can't seem to remove those damn '\n' for the life of me. I've

Shellwords.shellescape implementation for Ruby 1.8

六眼飞鱼酱① 提交于 2019-12-05 01:30:02
问题 While the build of 1.8.7 I have seems to have a backported version of Shellwords::shellescape , I know that method is a 1.9 feature and definitely isn't supported in earlier versions of 1.8. Does anyone know where I can find, either in Gem form or just as a snippet, a robust standalone implementation of Bourne-shell command escaping for Ruby? 回答1: You might as well just copy what you want from shellwords.rb in the trunk of Ruby's subversion repository (which is GPLv2'd): def shellescape(str)

How to escape path containing spaces

倾然丶 夕夏残阳落幕 提交于 2019-12-05 01:29:18
To pass a path with spaces to .NET console application you should escape it. Probably not escape but surround with double quotes: myapp.exe --path C:\Program Files\MyApp` becomes new string[] { "--path", "C:\Program", "Files\MyApp" } but myapp.exe --path "C:\Program Files\MyApp" becomes new string[] { "--path", "C:\Program Files\MyApp" } and it works fine and you can parse that easily. I want to extend the set of parameters given with an addition one and start a new process with the resulting set of parameters: new ProcessStartInfo( Assembly.GetEntryAssembly().Location, String.Join(" ",

Quoting YAML (for Travis CI)

谁说胖子不能爱 提交于 2019-12-05 00:45:07
How would I escape a whole line in YAML? I want to have json='{"title": "travis_saulshanabrook_site","key": "'$(cat ~/.ssh/id_rsa.pub)'"}' in a list, but I can't get it to parse into a string. I can put single quotes around the whole line, but then I would have to escape every single quote in my string, making it very hard to read. The string will be run as a bash command in Travis CI The most elegant solution is to use the literal style | indicator, with the - modifier to strip the final newline. That way there are no extra quotes necessary. If this scalar happens to be the only thing in a

How can I escape characters in SQLite via bash shell?

限于喜欢 提交于 2019-12-05 00:36:49
问题 I am trying to send a query to SQLite from the command line using bash. I need to escape both single quotes and double quotes, and escape them so that bash does not misinterpret them. Here is a typical query: select * from contacts where source = "Nancy's notes"; How can I send this query from the command line? The basic syntax is something like this: sqlite3.bin contacts.db 'select * from contacts where source = "Nancy's notes"' But in this case, the shell misinterprets either the single or

Raw literal strings in Julia

坚强是说给别人听的谎言 提交于 2019-12-05 00:21:06
In Python one can write r"a\nb" in order to prevent the \n from being interpreted as an escape sequence for newline. Is there something similar in Julia? And what about string interpolation like "$variable" , is there a way to prevent it? I know one can simply write "a\\nb" and "\$variable" in Julia, but I would like to write a lot of LaTeX strings without having to care to proper escape every backslash \ and dollar $ characters... (In Julia, r"..." creates a regular expression.) From Julia 0.6 we have raw"\a$variable" Ok, I just found out that since one can easily create non-standard string