I'm having an issue calling a PS script with two parameters. Both parameters are standard SMTP addresses, but the first parameter can have multiple addresses separated by semi colons.
The script runs fine if there is only one address in each parameter. I can get it to work ok if the first parameter has multiple addresses if I put single quotes around the parameter.
Where I run into problems is if the first parameter has multiple addresses and one (or more) of the addresses has an apostrophe (i.e. o'brien#foo.com).
Is there a way I can enclose the first parameter so that it can contain both apostrophes and semi colons?
thanks.
You can either use a backtick (`) to escape it, or surround it with double quotes. It sounds like we're talking about a To and From type parameter? Here's an example that might be close:
Send-MailCommandThing -sendTo 'One#one.com;two#two.com' -sendFrom "o'brien#foo.com"
Related
I'm trying to add content in a txt file with the add-content command but within the text I have things like several "",,[], commands that I don't want powershell to run but I can't get powershell to identify all as text.
My question, could you add some kind of delimiter as in MySQL that indicates that it treats everything inside as text?
To prevent PS interpreting that characters, you must to use bacticks before the character (e.g.: `[, `\, `"). Do not confuse with apostrophe (')
I am trying to create multiple html files that are associated with an email address. But since the "#" cannot be used in filenames, and in order to avoid confusion, I am trying to replace it with a character that won't normally exist in an email address.
Anything comes in mind?
Thanks!
Comma and semi-colon is not allowed in email address but in filenames on most file systems.
I believe '~' is used for this purpose.
According to the link here almost all ASCII characters are allow in email addresses so long as the special characters aren't at the beginning or the end.
What characters are allowed in an email address?
Any of , (comma) ; (semi-colon) <> (angle brackets) [] (square brackets) or " (double quote) should work for most cases.
Since these characters are allowed in quoted strings, you could replace the "#" with a sequence that would be invalid such as three double quotes in a row.
According to the RFC
within a quoted string, any ASCII graphic or space is permitted without blackslash-quoting except double-quote and the backslash itself.
You could have an email abc."~~~".def#rst.xyz. But you could not have abc.""".def#rst.xyz; it would have to be abc.""".def#rst.xyz. So you could safely use """ as a substitute for # in the filename.
However, the RFC also says
While the above definition for Local-part is relatively permissive,
for maximum interoperability, a host that expects to receive mail
SHOULD avoid defining mailboxes where the Local-part requires (or
uses) the Quoted-string form or where the Local-part is case-
sensitive.
With SHOULD meaning "...that
there may exist valid reasons in particular circumstances when the
particular behavior is acceptable or even useful, but the full
implications should be understood and the case carefully weighed
before implementing..." RFC2119
So, although """ will work, are the chances you will see an email with quotes worth the trouble of designing for it? If not, then use one of the single characters.
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.
I am building some tables in org-mode and I need to enter "||" into the table (for the logical OR command) and nothing I try turns the two characters off as table constructors.
I've tried single quotes, double quotes, backticks and prefacing them with '\'. I've also tried every permutation of using ':=' to get a literal string and they don't work.
// Tony Williams
Depending on what you want to do with the output of the table, you could use alternative unicode characters that look like vertical pipes (or double vertical pipes). Examples:
This is the pipe character written twice (as for logical OR):
||
Those are similar (or not too different) looking unicode characters
‖ - ¦¦ - ❘❘
Of course, this won't work for you if you are not just interested in the looks (but escaping pipes would not work either).
See here more unicode characters you might like better than those 3 above
It turns out that you can use HTML entities in org-mode tables for output via pandoc.
\vert{} doesn't work but I went to the table pointed to by MrSpock and tried the HTML entity and the output when run through pandoc was perfect. || gives me '||'. I also tested a few other HTML entities and they also worked fine.
Well, if the goal is to export your notes, then
$\lvert\mathbb{N}\rvert$
would be an equivalent of
$|\mathbb{N}|$
Character is: \vert
Example: a \vert\ b -> a | b
I'm working on a replacement for a desktop Java app, a single page app written in Scala and Lift.
I have this situation where some of data in the database has properly used HTML metacharacters, such as Unicode escape sequences for accented characters in non-English names. At the same time, I have other data with improper HTML metacharacters, such as ampersands in the names or organizations.
Good (don't escape): Universita\u0027
Bad (needs escape): Bob & Jim
How do I determine whether or not the data needs to be fixed before I send it to the client?
There are two ways to approach this. One is a function that takes a string and returns the index of any improperly escaped HTML metacharacters (which I can fix myself). Alternately it could be a function that takes a string and returns a string with the improperly escaped metacharacters fixed, and leaves the proper ones alone.