Special characters in flyway.conf password - configuration

How are special characters (\,#,:,=) in flyway.conf handled? Do they have to be escaped as in a .properties, or do they have to be written down as literals?

They are not and it is a awful bug. workaround is to set flyway.password instead of using param -password

Related

Perl Remove invalid characters, invalid latin1 characters from string

I have a perl script that reads from a web service and saves in a mysql table. this table uses latin1. from the web service there are coming some wrong characters and need to remove them before saving them in the database, otherwise they get saved as '?'
wanted to do something similar as:
$desc=~s///gsi;
but is not removing them.
the webservice that has the wrong characters is: https://jobvacancies.services.businesslink.gov.uk:8443/vacancy/26653478
using a user agent to get the data, seems coming in utf8 but the characters need to be removed:
my $ua = LWP::UserAgent->new ();
$ua->default_headers->push_header ('Accept' =>
"text/html,application/xhtml" .
"+xml,application/xml");
$ua->default_headers->push_header ('Accept-Charset' => "utf-8");
my $doc = $ua->get ("https://jobvacancies.services.businesslink.gov.uk:8443/vacancy/26653478")
If you just want to remove the characters outside the 7-bit ascii set (which are sufficient to display messages in english), you can you do this:
$desc=~s/[^\x00-\x7f]//g
Edit: If you want something more elaborate that supports the entire latin-1 set, you can do this:
use Encode;
$desc=encode('latin-1',$desc,sub {''});
This will remove exactly the characters that cannot be represented by latin-1. Note that this line expects that the utf-8 flag is on for the string $desc and that the resulting string will have the utf-8 flag is off.
Finally, if you want to preserve the euro sign (€), please note that you cannot do that with latin-1 because it is not part of that encoding. You will have to use a different encoding, such as ISO-8859-15.
The content sent by the web service is XML that contains HTML in the Description tag. If this is that content that worries you, another option than deleting non-Latin-1 character is to encode characters using HTML encoding:
$desc =~ s/([^\x00-\x7f])/sprintf("&%d;", ord $1)/ge
Here is an example:
$ echo 'é' | perl -C -pE 's/([^\x00-\x7f])/sprintf("&%d;", ord $1)/ge'
&233;
Change your column definition to CHARACTER SET utf8mb4 so that the naughty character does not need to be removed, and can actually be stored.

special characters with Net::Twitter::Lite

I try to send characters like ü, ä, ß, à and so on to twitter. If I use unicode characters in my scripts they come out wrong in twitter. If I use HTML (which is possible in twitter's web-interface and which used to work previously) I see now ü rather than "ü" in the post. Is there a parameter or something that I have to set? Some call to encode/decode? I am using:
use Net::Twitter::Lite::WithAPIv1_1;
I find myself checking out the test suite of perl modules quite often as it is a good source for examples.
Net::Twitter expects decoded characters, not encoded bytes So, sending
encoded utf8 to Net::Twitter will result in double encoded data.
Source: https://metacpan.org/source/MMIMS/Net-Twitter-Lite-0.12006/t/unicode.t
Try
use encoding 'utf8';
at the begining of your script. sometimes this is the solution of many utf8 problems.

TCL set Special Characters in a string

I want to set in TCL the below error message as a variable and compare with the error message from a network switch, by-passing the special characters
Use [slot/port] or ["portname"] or [slot/*] or [*].
I tried in this way
set x "Use \[slot/port] or \["portname"] or \[slot/\*] or \[\*]."
but I am getting the following message while running my script:
extra characters after close-quote
while executing
Please help. Thank you!
If you use double quotes, you also have to escape "inner" quotes:
set x "Use \[slot/port] or \[\"portname\"] or \[slot/*] or \[*]."
Or use braces and avoid escaping altogether
set x {Use [slot/port] or ["portname"] or [slot/*] or [*].}
See Tcl's 12 syntax rules, numbers 4 and 6
Well, you can use wrap it in curly brackets as follows:
set x {Use [slot/port] or ["portname"] or [slot/] or [].}
Alternatively, you can escape special characters with backslash.
Escape the double quotes in your quoted string as well. Or use curly-braces to group the string without any command or variable substitution occurring.
set s {Use [slot/port] or ["portname"] or [slot/*] or [*].}
puts $s
set s "Use \[slot/port\] or \[\"portname\"\] or \[slot/*\] or \[*\]."
puts $s
You need to keep reading the documentation on quoting until you understand why this is ok and your example is broken or you will suffer endless problems in your scripting.
Note that the code colouring implemented on stackoverflow will show the curly-braced version poorly. Tcl is quite content with this however.

Convert special characters (é) to normal (e)

My application breaks because some strings that are given as an argument in a url for an httpservice-request contain special characters such as é. Is their a way to convert them to their normal variant (in this case e)?
There is no function that would do it automaticaly for you. You'll have to replace everything one special character at a time.
You could use escape and unescape to safely post with your service.

Sanitizing MySQL user parameters

What are the dangerous characters that should be replaced in user input when the users' input will be inserted in a MySQL query? I know about quotes, double quotes, \r and \n. Are there others?(I don't have the option of using a smart connector that accepts parameters so I have to build the query myself and this will be implemented in multiple programming languages, including some obscure ones so solutions such as mysql_real_escape_string in PHP are not valid)
mysql_real_escape_string() from mysql.com docs:
The string in from is encoded to an escaped SQL string, taking into account the current character set of the connection. The result is placed in to and a terminating null byte is appended. Characters encoded are NUL (ASCII 0), “\n”, “\r”, “\”, “'”, “"”, and Control-Z (see Section 8.1, “Literal Values”). (Strictly speaking, MySQL requires only that backslash and the quote character used to quote the string in the query be escaped. This function quotes the other characters to make them easier to read in log files.)
mysql_real_escape_string() is character set aware, so replicating all its abilities (especially against multi-byte attack issues) is not a small amount of work.
From http://cognifty.com/blog.entry/id=6/addslashes_dont_call_it_a_comeback.html:
AS = addslashes()
MRES = mysql_real_escape_string()
ACS = addcslashes() //called with "\\\000\n\r'\"\032%_"
Feature AS MRES ACS
escapes quote, double quote, and backslash yes yes yes
escapes LIKE modifiers: underscore, percent no no yes
escapes with single quotes instead of backslash no yes*1 no
character-set aware no yes*2 no
prevents multi-byte attacks no yes*3 no
What languages do you need to support? It is much better to use a language's built-in sanitization than to write your own.
Edit: Looking at mysql_real_escape_string on php.net:
mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.