MongoDB Compass can't connect to db because Password contains unescaped characters - mongodb

I have mongo db credentials that have a [ in it. I am getting an error that says "Password contains unescaped characters". I don't know how to rectify while keeping the password the change. Any help on this would be greatly appreciated.

It happened to me today.
Just replace the unescaped characters with the escaped code. It works.
https://docs.microfocus.com/OMi/10.62/Content/OMi/ExtGuide/ExtApps/URL_encoding.htm

Related

Postgres storing and retrieving double quotes

I am storing data which includes single and double quotes in a column which has a type of text.
I have a function that returns that column but it always returns the double quote character being doubled up. I tried to escape the character \" but that just returned \"". I have the same process working in MySQL well. I am trying to move to Postgres for greater scaling and stability but it seems it does not work well. I have noticed in pgAdmin when I look at the data output, it seems to show the data correctly so I am wondering what is being done there for it to work correctly?
Also I am getting a (" at the start of the returned value and ") at the end.
Can someone help please?
Use pg_escape_string to escape quote characters in your string.

How to resolve java.security.spec.InvalidKeySpecException: Password is not ASCII

I have one test named test_PBE_Triple_DES, here I am using PBE_DES3_CBC_SHA1_ALGORITHM to decode the encrypted password but whenever I try to execute it I get an error saying that the password is not ascii.
I have provided the stacktrace below.
com.tibco.security.AXSecurityException: java.security.spec.InvalidKeySpecException: Password is not ASCII
at com.tibco.security.providers.CryptoVendorImpl_j2se.rename(CryptoVendorImpl_j2se.java:205)
at com.tibco.security.Crypto.rename(Crypto.java:59)
at com.tibco.security.TestPassword.test_PBE_Triple_DES(TestPassword.java:105)
Caused by: java.security.spec.InvalidKeySpecException: Password is not ASCII
at com.sun.crypto.provider.PBEKey.<init>(PBEKey.java:64)
at com.sun.crypto.provider.PBEKeyFactory.engineGenerateSecret(PBEKeyFactory.java:219)
at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:330)
at com.tibco.security.providers.CryptoVendorImpl_j2se.rename(CryptoVendorImpl_j2se.java:161)
In case anyone runs into this, I was reading the password from a file on the system and it had a newline automatically appended at the end of it it by vim. After I turned off the feature off in vim it worked fine.
Here's how to disable new line.
How to stop VIM from adding a newline at end of file?
I think the password must be number. Ex: 1247980375091875908431789013789013578901759.
Worked for me.
Yes, In my case there was new line character was appended. Just added trim method and it got resolved

PGAdmin / Postgres : Cannot write Timestamp data to Postgres (2018-04-18 05:40:28)

When I try to write the following date time format to Postgres using Pgadmin
2018-04-18 05:40:28
I get the following error. ERROR: invalid input syntax for type timestamp: "2018-04-18 05:40:28"
CONTEXT: COPY timestamp, line 1, column date: "2018-04-18 05:40:28"
I am trying to write the data using the timestamp format within Postgres.
Any pointers on where I am going wrong would be much appreciated.
Thank you.
My educated guess: you have a leading BOM (byte order mark) in the file that should be removed.
How do I remove  from the beginning of a file?
Or some exotic whitespace or non-printing character that should be removed or replaced.
Trim trailing spaces with PostgreSQL
And the offending character (well, the BOM is not a "character", strictly speaking, it's just mistaken for one) was not copied to the question. That would explain the otherwise contradicting error message.
To test, copy the "2018-04-18 05:40:28" part from the error message and paste it in a pgAdmin SQL editor window (which you seem to be using) and test:
SELECT '"2018-04-18 05:40:28"' = '"2018-04-18 05:40:28"';
---------^ BOM here?
I added a leading BOM to demonstrate in the first string. Type the second string by hand to be sure it's plain ASCII. If you get false, we are on to something here.
But we cannot be too sure, your question is confusing and essential information is missing. Don't use the basic type names timestamp and date as identifiers, for sanity.

Escape FTP password with special characters via CLI

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 %%).

read double quotes and single quotes from Sqlite database

In my application I am trying to read some data from sqlite database into UITextView.
This text has double quotes as well as single quotes, for ex:
she said : "Katie's purse has been
lost"
when I do this, I get strange characters in place of double and single quotes. Please help me with a solution to scrub these characters off.
Thanks.
If you get one strange character (or set of characters) replacing " and another replacing ', you can just scan the string and replace. If you aren't, then:
That's very strange, and
You should post your code.