how can my password contain special characters using jasypt and encrypt.sh? - jasypt

Trying to use the encrypt.sh utility and my password has special characters:
./encrypt.sh input="$%#!" password="your_jasypt_password" algorithm="PBEWITHSHA256AND128BITAES-CBC-BC" keyObtentionIterations=1000 providerName="BC"
-bash: !": event not found

Ok easy-- need to use single quotes instead of double quotes.

Related

Using Umlaut or special characters in ibm-doors from batch

We have a link module that looks something like this:
const string lMod = "/project/_admin/somethingÜ" // Umlaut
We later use the linkMod like this to loop through the outlinks:
for a in obj->lMod do {}
But this only works when executing directly from DOORS and not from a batch script since it for some reason doesn't recognize the Umlaut causing the inside of the loop to never to be run; exchanging lMod with "*" works and also shows the objects linked to by the lMod.
We are already using UTF-8 encoding for the file:
pragma encoding, "UTF-8"
Any solutions are welcome.
Encode the file as UTF-8 in Notepad++ by going to Encoding > Convert to UTF-8. (Make sure it's not already set to UTF-8 before you do it).

JavaScript: Escape (encode?) special characters in filenames

I have a JavaScript that runs an external program (mediainfo) on local files. However, some of my files have characters that mess up my code.
The code:
objMedInfo = JSON.parse(proc.execSync('mediainfo "' + currentfilename + '" --output=JSON').toString());
The problem is that if currentfilename contains a quotation mark or some other extended characters, the command fails.
Is there a way to escape or encode currentfilename to prevent this? It's not feasible to rename all the potential files.
Use execFileSync instead of execSync. This allows you to supply the arguments in an array, rather than putting everything in a string that has to be parsed by the shell.
objMedInfo = JSON.parse(proc.execFileSync('mediainfo', [currentfilename, '--output=JSON']).toString());

NSString stringWithFormat can't add backslash

I'm calling a webService using AFNetWorking and want to pass a parameter of this shape,
112212234234324#abcdefghi_def.ab\/AB
and to achieve that i'm using following code,
#{#"someKey":[NSString stringWithFormat:#"%##%#\/AB", someTextField.text, [aDictionary objectForKey:#"someOtherKey"]]};
But stringWithFormat is ignoring backslash and value for someKey is,
112212234234324#abcdefghi_def.ab/AB
I've also tried this,
#{#"someKey":[NSString stringWithFormat:#"%##%#\\/AB", someTextField.text, [aDictionary objectForKey:#"someOtherKey"]]};
but it won't treat double slash as single slash and someKey value is,
112212234234324#abcdefghi_def.ab\\/AB
NSLog is converting fine.
NSLog(#"\\"); gives \
NSLog(#"\\\\"); gives \\
NSLog(#"\\/"); gives \/
Please help.
Try this one:
#{#"someKey":[NSString stringWithFormat:#"%##%#%#/AB", someTextField.text, [aDictionary objectForKey:#"someOtherKey"],#"\\"]};
Just solved it by skipping \. After discussing with backend team, i came to know that backslash will be ignored anyways by parser so it isn't needed.
Updated code looks like,
#{#"someKey":[NSString stringWithFormat:#"%##%#/AB", someTextField.text, [aDictionary objectForKey:#"someOtherKey"]]};

What does # in front of a Dart string mean

I found some Dart code with # in front of a string:
_specialCharactersInsideCharacterClass = new HashSet.from([#"^", #"-", #"]"]);
Found in: RegExpBuilder.dart
What is the meaning of the symbol # in this case?
Right now, a prefix # character in front of a string is not valid Dart code. But I can imaging that it is was used to disable escaping and string interpolation in the past. The linked Dart file is from 2013, so maybe it was created before the prefix r was introduced to mark raw strings:
_specialCharactersInsideCharacterClass = new HashSet.from([r"^", r"-", r"]"]);
In raw strings, string interpolation (using the $ character) and escaping (for example \r) are disabled.

Iconv.conv in Rails application to convert from unicode to ASCII//translit

We wanted to convert a unicode string in Slovak language into plain ASCII (without accents/carons) That is to do: č->c š->s á->a é->e etc.
We tried:
cstr = Iconv.conv('us-ascii//translit', 'utf-8', a_unicode_string)
It was working on one system (Mac) and was not working on the other (Ubuntu) where it was giving '?' for accented characters after conversion.
Problem: iconv was using LANG/LC_ALL variables. I do not know why, when the encodings are known, but well... You had to set the locale variables to something.utf8, for example: sk_SK.utf8 or en_GB.utf8
Next step was to try to set ENV['LANG'] and ENV['LC_ALL'] in config/application.rb. This was ignored by Iconv in ruby.
Another try was to use global system setting in /etc/default/locale - this worked in command line, but not for Rails application. Reason: apache has its own environment. Therefore the final solution was to add LANG/LC_ALL variables into /etc/apache2/envvars:
export LC_ALL="en_GB.utf8"
export LANG="en_GB.utf8"
export LANGUAGE="en_GB.utf8"
Restarted apache and it worked.
This is more a little how-to than a question. However, if someone has better solution I would like to know about it.
You can try unaccent approach instead.

Resources