My site was hacked and I was able to retrieve some SQL from binlog, they look like
<p>some text</p>\r\n<p><img src=\"images/2019-04-27/1.jpg\" alt=\"1\" /></p>
I need to convert \r\n to new line and unescape the double quotes.
Of course I can write my own function to achieve this, but since there are lots of SQLs to convert, I am not sure if \r\n and \" are the only things I need to deal with.
I think the key here is to find out what this conversion is called so I can google. I tried "html encode", "html escape" and "sql escape", none of them worked.
So, is there any PHP or JAVASCRIPT function that can handle this? Or is there any online tools?
Python automatically converts /n into a new line for you. For example, if you go onto this website here - www.repl.it/languages/python3
string = '<p>some text</p>\r\n<p><img src=\"images/2019-04-27/1.jpg\" alt=\"1\" /></p>'
print(string)
Copy the above code into it and you'll see the string is given a new line
If you need to use a multi line string put the string in 3 quotation marks like so.
string = '''
I
am
a
multi
line
string
'''
Related
In my program we originally were using Java with Preview Features enabled, which gave as a feature to use String blocks defined in between three double quotes. For example:
String s = """
Line one
Line two
""";
Now, we decided to go back to Java 14 and I need to replace those with regular String declaration in all project (which is around ~1000 occurrences). Is there a way to do that in bulk?
String s = "Line one\n"+
"Line two\n";
You can run the inspection "Text block can be replaced with regular string literal" inspection on your code using the "Run Inspection by Name" action. It has a quick fix to do the conversion for you.
In vue, is there a way to have a value span multiple lines in an .env file. Ex:
Instead of:
someValue=[{"someValue":"Here is a really really long piece which should be split into multiple lines"}]
I want to do something like:
someValue=`[{"someValue":"Here is a really
really long piece which
should be split into multiple lines"}]`
Doing the latter gives me a JSON parsing error if I try to do JSON.parse(someValue) in my code
I don't know if this will work, but I can't format a comment appropriately enough to get the point across so see if this will work:
someValue=[{"someValue":"Here is a really\
really long piece which\
should be split into multiple lines"}]
Where "\" should escape the newline similar to how you can write long bash commands while escaping the newline. I'm not certain the .env interpreter will support it though.
EDIT
Looks like this won't work. This syntax was actually proposed, but I don't think it was incorporated. See motdotla/dotenv#333 (which is what Vue uses to parse .env).
Like #zero298 said, this isn't possible. Likely you could delimit the entry with a character that wouldn't show up normally in the text (^ is a good candidate), then parse it within the application using string.replace('^', '\n');
I am trying to take a string like "Hello my name is Nick" and transform it to "Hello+my+name+is+Nick" to be passed through a URL. This would be easily done by replacing all the spaces with a + char however I also need to replace all special characters (. , ! &) with their ASCII values. I have searched the net but cannot find anything. I wonder if anyone knows of existing code to do this as its a fairly common task?
I think you're looking for this: HttpUtility.UrlEncode Method (String)
Handles non-URL compliant characters and spaces.
I have a string like "Hello'World" and a DataTable with some records in it. One of those records is "Hello'World".
The problem is, when I do a .Select in the DataTable, it only tries to search for the "Hello" part and throws an error on "World" because it interprets the ' (single quote) like the closing quote on sql.
DataTable.Select("text = 'Hello'World'")
I have gone through msdn doc, and it says I can escape some characters with [] brackets or f.slashes \, but I just can't figure out: .select("text = 'Hello[']world'")
I've done some reading: Verbatim in vb - c# and "jmcilhinney" explains it really well. BUT, it did not answer my question for what I want to do. In stackoverflow.com, a same question is posted but in c#, but I can't find a way to use # in vb.
Can you please redirect me to more doc, examples or any one of you have ever encountered this problem?
Use '' (this is 2 ' characters).
DataTable.select("text = 'Hello''World'")
I've made some good progress with my first attempt at a program, but have hit another road block. I'm taking standard output (as a string) froma console CMD window (results of dsquery piped to dsget) and have found small rectangles in the output. I tried using Regex to clean the little bastards but it seems they are related to the _ (underscore), which I need to keep (to return 2000/NT logins). Odd thing is - when I copy the caharcter and paste it into VS2K10 Express it acts like a carrige return??
Any ideas on finding out what these little SOB's are -- and how to remove them?
Going to try using /U or /A CMD switch next..
The square is often just used whenever a character is not displayable. The character could very well be a CR. You can use a Regular Expression to just get normal characters or remove the CR LF characters using string.replace.
You mentioned that you are using the string.replace function, and I am wondering if you are replacing the wrong character or something like that. If all your trying to do is remove a carriage return I would skip the regular expressions and stick with the string.replace.
Something like this should work...
strInputString = strInputString.replace(chr(13), "")
If not could you post a line or two of code.
On a side note, this might give some other examples....
Character replacement in strings in VB.NET