Pass new line to description field in ics export from sharepoint - sharepoint

I am exporting an ics file from a sharepoint list item using the following format:
http://sharepoint/site/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=[List GUID]&CacheControl=1&ID=[Item ID]&Using=event.ics
I have a column in my list called description, this gets passed to the generated ics file in the correct place but any \n's seem to get escaped to this \\n which displays as text in the calendar appointment.
I have tried many different options but cannot seem to get this working.
\n gets replaced with \\n
\134n gets replaced with \\n
\\n generates correctly but does not work
\012 seems to break the ics file unless it is followed by a whitespace character, but then it gets unfolded and ignored.
I refuse to believe that this is impossible. Any help will be appreciated and any solution will save me days of frustration.

I do not know how the original data is stored but icalendar spec (RFC5545) specs:
The "TEXT" property values may also contain special characters
that are used to signify delimiters, such as a COMMA character for
lists of values or a SEMICOLON character for structured values.
In order to support the inclusion of these special characters in
"TEXT" property values, they MUST be escaped with a BACKSLASH
character. A BACKSLASH character in a "TEXT" property value MUST
be escaped with another BACKSLASH character. A COMMA character in
a "TEXT" property value MUST be escaped with a BACKSLASH
character. A SEMICOLON character in a "TEXT" property value MUST
be escaped with a BACKSLASH character. However, a COLON character
in a "TEXT" property value SHALL NOT be escaped with a BACKSLASH
character.
Example: A multiple line value of:
Project XYZ Final Review
Conference Room - 3B
Come Prepared.
would be represented as:
Project XYZ Final Review\nConference Room - 3B\nCome Prepared.
So for your export to work you should leave \n as is, replace CRLF by \n and also hope your user has a standard compliant calendar tool.

Related

How to add trailing spaces or blanks in the report

Apparently the report seems to explicitly trimming any trailing spaces on report fields. But I need those spaces because it's a bank feed. I got an expression something like :
=PadRight( [BAccount.AcctName] , 50, ' ' )
or
=' BLAH '
Still no spaces
Does anyone has any tricks to achieve it ?
TIA
I believe the report engine will trim all whitespace and non-printable characters.
Does anyone has any tricks to achieve it ?
Yes, based on assumption above; one possible trick is to append a printable Unicode character at the end of the string that renders as whitespace but isn't technically considered white space. This type of trick is very common in phishing attacks.
I choose the 'Braille Pattern Blank' character which renders like a space character but isn't considered whitespace.
Reference:
https://www.compart.com/en/unicode/U+2800
You can copy it directly from character box in link above (highlighted blue):
And paste it in Acumatica report designer to append it after the blank space:
I tested this by selecting the field in report, it appended the desired spaces:

CSV File with values having single quote within quote text qualifier

I am trying to parse a CSV file which has single quote as text qualifier. The problem here is that some values with single quote text qualifier itself contains single quote
e-g:
'Fri, 24 Feb 2017 17:44:57 +0700','th01ham000tthxs','/','','Writer's Tools Data','7.1.0.0',
I am struggling to parse the file as after this row, all of the remaining rows get displaced.
I tried working with OpenCSV, UnivocityParsers but didn't get any luck.
If I place the above row in excel (Excel Image) and provide text qualifier as single quote, it give correct result without any displacement of rows.
If using java, the JRecord library should handle the File.
How it works: if a field starts with a quote (e.g. ,') specifically look for ', or ''', or ''''', or ' etc (an odd number of quotes followed by either a comma or end-of-line marker). This approach breaks down if:
The embedded quote is the last character in a field i.e. 'Field with quote '',
White space between the quote and comma i.e. 'Field' , or , '
Here is the line in ReCsvEditor
Also in the ReCsvEditor when editing the file, if you select Generate >>> Java Code >>> ... it will generate Java/JRecord Code to read the file.
Disclaimer: I am the author of JRecord / ReCvEditor. Also the ReCsvEditor Generate function is new and needs more work
Try configuring univocity-parsers to handle the unescaped quote according to your scenario. 'Writer's Tools Data' has an unescaped quote. From your input, I can see you want to use STOP_AT_CLOSING_QUOTE as the strategy to work around these values.
Add this line to your code and it should work fine:
parserSettings.setUnescapedQuoteHandling(UnescapedQuoteHandling.STOP_AT_CLOSING_QUOTE);
Hope this helps.

How to change single column of a file to uppercase in linux?

I have a file with two fields. I need to change the first field values from lowercase to uppercase. Can anyone give me a suggestion on how can I do this?
sample file data
e6|VerizonOctoberWB_PromoE7E6
e2|VerizonOctoberWB_UnlimwP_E1E2
e5|VerizonOctoberWB_PromoLI_E5
In above sample data I need to change the first field values(e6,e2,e5)
Given your small and poorly formatted sample:
cat up
e6|VerizonOctoberWB_PromoE7E6
e2|VerizonOctoberWB_UnlimwP_E1E2
e5|VerizonOctoberWB_PromoLI_E5
sed -r 's/^([^|]+)/\U\1\E/g' up
E6|VerizonOctoberWB_PromoE7E6
E2|VerizonOctoberWB_UnlimwP_E1E2
E5|VerizonOctoberWB_PromoLI_E5
Edit 1: added explanation:
search for and remember everything from beginning of line up to the first separator |, replace with \U(start upper-casing), \1 remembered string, \E stop upper-casing.

Vim search and replace to amend a string with common structure but varying words

I'm fairly new to Vim and I haven't been able to find on this site how to search and replace with a varying part of a string. I need to apply a global edit to all times "SetTag("...")" appears with ... being any word. My edit is to add one more word after the second quotation mark. example: SetTag("err" + __LINE__ with the bolded part being what I need to add. Can anyone let me know how this is possible with a vim search command? Thanks!
nb: I assume "word" is any sequence of characters other than a doublequote character. Modify as needed.
:%s/SetTag("\([^"]*\)")/SetTag("\1" + __LINE__)/
the escaped parentheses grab the sub-match; the \1 in the replacement string is replaced by that sub-match.

#Name error in excel sheet

I have a csv file which is filled automatically through a java programm. I have a line which have the following text when I open the text in Notepad++:
-LRB- from the PMI Practice Standard for Work Breakdown Structures , Oct 2000 -RRB- '',"no","f1_FRAG:1.0","f2_specialChar:1.0","f3:15.0","f4:7.0","f5:0.0","f6:2.0","f7:0.0","f8:3.7612001156935624","f9:7.0","f10:1.0","f11:1.0","f12:0.0","f13:0.0","f14:0.0,"f15_ROOT:1.0","f16_specialChar:1.0","f17_NOTHING:1.0","f18_IN:1.0""
But when I open it in excel sheet, there are two problems:
1) When I click on the cell, I see #Name error and any click on the page causes an error. I even can't close the excel window normally. I also sometimes see something like =A228 or =B223 when I click on the cell. It sounds to be read as a formula, but it actually isn't.
2) The row is not shown completely. I can't see this part when I open the file using office excel:
",f15_ROOT:1.0","f16_specialChar:1.0","f17_NOTHING:1.0","f18_IN:1.0"".
Any help is appreciated.
Since the row starts with a - (minus sign), Excel is expecting a formula.
Manually, you could either:
add an ' (apostrophe) at the beginning of the line (which tells Excel that the cell contains text), or
Format the cell as text : Right-click the cell → Format Cells → Number tab → Text
Ideally, to prevent this issue in the future, the Java program which generates the .CSV file should be changed to enclose text fields with " double quotation marks.
Oddly, that is the only field in your example that isn't surrounded by double quotes.
"-LRB- from the PMI Practice Standard for Work Breakdown Structures , Oct 2000 -RRB- ''","no","f1_FRAG:1.0","f2_specialChar:1.0","f3:15.0","f4:7.0","f5:0.0","f6:2.0","f7:0.0","f8:3.7612001156935624","f9:7.0","f10:1.0","f11:1.0","f12:0.0","f13:0.0","f14:0.0,"f15_ROOT:1.0","f16_specialChar:1.0","f17_NOTHING:1.0","f18_IN:1.0""
At the minimum, double-quotes should the used around any fields that begin with a symbol or contain a comma (like above).
1997,Ford,E350,"Super, luxurious truck"
The double-quotes will be recognized and removed by most apps that open CSV's.
Any field may be quoted (that is, enclosed within double-quote characters). Some fields must be quoted, as specified in following
rules.
"1997","Ford","E350"
Fields with embedded commas or double-quote characters must be quoted.
1997,Ford,E350,"Super, luxurious truck"
Each of the embedded double-quote characters must be represented by a pair of double-quote characters.
1997,Ford,E350,"Super, ""luxurious"" truck"
.
More about Comma Separated Value files:
Wikipedia: CSV Files - Basic Rules
RFC 2046 Standard
RFC4180 Standard
.
Surprisingly, I can't find any reference document from Microsoft that mentions starting text cells with an apostrophe. (I guess it's a secret, so if anyone asks, you didn't hear it from me.) :-)
The reason you are getting the #NAME error specifically is because Excel figures you're trying to enter a formula (because of the minus sign) but it doesn't recognize the Name of the function ("LRB")

Resources