Escape FTP password with special characters via CLI - command-line

Trying to use Grunt FTP deploy plugin. Have an FTP password with the characters !,#,%,# and can't seem to find which of and how these need to be escaped.
I've tried wrapping the entire password string in single-quotes and \ escaping each character. In the former case I still get and auth failed error; in the latter case, I get an error like "Unexpected token #".

README.md
IMPORTANT: make sure that the .ftppass file uses double quotes (which is the proper JSON syntax) instead of single quotes for the
names of the keys and the string values.
String
Series of characters (letters, numbers, or symbols); double-quoted
UTF-8 with backslash escaping.

I know it is an old question but I just had this problem and finally found a solution.
My CLI is Windows and my problem was related a batch script where the password for my SFTP (using PSFTP) had special charachters.
I solved it escaping the password with the rules described here:
https://www.robvanderwoude.com/escapechars.php
The password was "X5d2KeY6%0123ghjy".
The password became "X5d2KeY6%%0123ghjy" (that is, % became %%).

Related

How to use special characters in supervisord config file?

I am trying to configure Supervisord with the inet_http_server web interface.
/etc/supervisor/supervisord.conf takes a username and password for the web interface, and I need to use a password that contains special characters like "!" and "$". However, when I start supervisor with these parameters, passwords with special characters like the dollar sign do not work. I've also tried placing the password in double quotes to no avail. I've also tried escaping the dollar sign with a back slash.
What is the correct syntax to get this to work?

CloudFormation Userdata to Base64 Decoding Incorrectly

I've created a CloudFormation template that creates an instance. I want to pass a PowerShell script into a windows instance via the user data; however, when it's encoded with Base64, the Cloudformation template does not decode it correctly.
I want to pass in this:
Set-DNSClientServerAddress -InterfaceIndex (Get-NetAdapter).InterfaceIndex -ServerAddresses ("172.31.15.30")
When I check the template in the CloudFormation it got decoded as:
Set-DNSClientServerAddress /u2013InterfaceIndex (Get-NetAdapter).InterfaceIndex /u2013ServerAddresses ("172.31.15.30")
When this is passed into the Windows instance, it doesn't recognize /u2013, and errors out.
How do I ensure the line I pass in keeps the dash, rather than decode it into Unicode.
Could you try this?
"Set-DNSClientServerAddress \-InterfaceIndex (Get-NetAdapter).InterfaceIndex \-ServerAddresses ("172.31.15.30")"
Based on others needing to escape other characters: AWS Cloudformation output double quotes in a file using Fn::Join
\u2013 is a different type of unicode dash character. Your editor probably used it because it looks nicer. Try editing your source code with notepad or a simple editor and replace that unicode dash with a proper dash. If you are having a hard time typing it, you can copy it from Set-DNSClientServerAddress. That one seems fine.

Single quotes stored in a Postgres database

I've been working on an Express app that has a form designed to hold lines and quotes.
Some of the lines will have single quotes('), but overall it's able to store the info and I'm able to back it up and store it without any problems. Now, when I want do pg_dump and have the database put into an SQL file, the quotes seem to cause some things to appear a bit wonky in my text editor.
Would I have to create a method to change all the single quotation marks into double, or can I leave it as is and be able to upload it back to the database without causing major issues. I know people will continue to enter in lines that contain either single or double quotations, so I would like to know any solution or answer that would help greatly.
Single quotes in character data types are no problem at all. You just need to escape them properly in string literals.
To write data with INSERT you need to quote all string literals according to SQL syntax rules. There are tools to do that for you ...
Insert text with single quotes in PostgreSQL
However, pg_dump takes care of escaping automatically. The default mode produces text output to be re-imported with COPY (much faster than INSERT), and single quotes have no special meaning there. And in (non-default) csv mode, the default quote character is double-quote (") and configurable. The manual:
QUOTE
Specifies the quoting character to be used when a data value is quoted. The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.
The format is defined by rules for COPY and not by SQL syntax rules.

lex default token definition syntax

I guess this is a simple question, but I have found no reference. I have a small lex file defining some tokens from a string and altering them (actually converting them to uppercase).
Basically it is a list of commands like this:
word {setToUppercase(yytext);}
Where setToUppercase is a procedure to change case and store it.
I need to have the complete entry string with the altered words. Is there a way to define a default token / rest of tokens so I can asociate them with an unaltered storage in an output string?
You can do that in one shot with:
.|\n {save_str(yytext);}
I said it was an easy one.
. {save_str(yytext);}
\n {save_str(yytext);}
This way all characters and newline are treated.

SharePoint 2013 REST API odata $filter ignores unicode characters such as German umlauts äöü

I'm trying to use SharePoint 2013 REST API (odata) with unicode characters such as umlauts (ä ö ü).
...?$select=Title%2CID&$filter=substringof%28%27hello%20w%F6rld%27%2C%20Title%29&$orderby=ID%20desc&$top=14
^^ should search for "hello w*ö*rld" using substringof('...', Field)
I'm escaping the URL correctly (and also single quotes with double quotes) and filtering works for all kinds of characters (even backslash and quotes), however, entering ä/ö/ü or any other unicode character has no effect, it is as if those characters were simply filtered out on the server side (i can insert a lot of ääääääs without changing the results).
Any idea how to escape those? I tried the obvious (%ab { \u1234 \xab x1234) without success. Can't find anything on the web or in the specs either.
Thanks for suggestions.
UPDATE - SOLVED
I found that you can use the %uhhhh variant of escaping them:
?$filter=substringof('hello w%u00f6rld')
Of course one must only escape that once (i.e. not the whole thing again), but it seems that's the way to go.
(can't answer my own question now lol)