Does the Wrap function in ColdFusion insert CR/LFs? - coldfusion

I have the need to do some word wrapping with a few considerations:
Source file is MS WORD
Copy and paste the text into a textarea in a cfform.
Use #wrap(theTextVar,80)# to dump out the text 80 characters
The text is uploaded to a legacy system which needs ansi or ascii chars uploaded.
Everything seems to work okay, I just wanted to confirm see if anyone else has had luck doing this and if they know if a CR / LF is entered after each line in the outputted text (Step 3)?

From the docs on wrap():
Uses the operating-system specific
line break: newline for UNIX, carriage
return and newline on Windows.
So if you are doing this on a Windows box, then the answer is yes.

Tried this?
<cffile action="write" file="i_will_show_the_secret_if_you_open_me_in_text_editor.html" output="#wrap(theTextVar,80)#" />

Related

problems opening particular rmd file/rstudio not responsive

I found the same problem that posted on this publication: https://community.rstudio.com/t/problems-opening-particular-rmd-file-rstudio-not-responsive/31049
I cannot open a specific rmd file, I get a blank white RStudio window. As explained in the link above I may have ended up with some non-ASCII text in my RMarkdown probably from copying and pasting text from a pdf.
The person in the post follow these steps in order to solve the problem:
delete the knitted html file associated with this rmd file
replace the culprit characters with 7-bit ASCII characters
reset RStudio state (deleting .Rhistory and .rstudio-desktop/)
But I do not know how to replace "the culprit characters with 7-bit ASCII characters".
Any help on this will be appreciated.
I did not try anything yet.

Regex working in notepad++ but not in python

am trying this regex (WVDC)((?:.*\r\n){1}) in notepad++ and it's working, but when I do the same in python it won't
text is
Above 85°C the rated (DC/AC) voltage must be derated at per 1.5%/2.5%°C
WVDC: 400 Volts DC
SVDC: 600 Volts DC
python code
re.search(r'(WVDC)((?:.*\r\n){1})',txt)
The following script is working for me in Python:
input = """Above 85°C the rated (DC/AC) voltage must be derated at per 1.5%/2.5%°C
WVDC: 400 Volts DC
SVDC: 600 Volts DC"""
result = re.findall(r'(WVDC).*\r?\n', input)
print(result)
['WVDC']
Note that the only substantial change I made to the regex pattern was to make the carriage return \r optional. So it seems that multiline strings in Python, perhaps what your source uses, carry only newlines, but not carriage returns. In any case, using \r?\n to match newlines is generally a good idea, because it can cover both Unix and Windows line endings at the same time.
You haven't shown a reproducible example, but opening files in Python in text mode will convert \r\n to \n. Notepad++ maintains the exact line endings.
Removing \r (or making it optional) from the regex should fix the problem in Python. You could also open the file in binary mode, but processing text in text mode is recommended.

How to get page break character in pycharm

So extracting text with pdftotext is quicker if you have it all in one file instead of one page per file. There is a special character being used as page break, but pycharm does not register it if I search for it. In sublime it shows up as <0x0c>. I cannot copy it here either. Is there a way to replace them with another readable character? Or to read it somehow to register when a page has changed?

How to write Russian characters to file with cffile

I have a string I need to write to create an XML file. The string has Russian characters in it, which I can cfoutput to the page no problem, but when I write the file with cffile, those characters return with a ?. I tried changing the charset to the following with no success:
windows-1252
iso-8859-1
cp1251
cp866
I'm sure the charset is the problem here. Any suggestions?
Here is one of the strings in question: Другие
I'm running ColdFusion 10 on a Windows Server 2008 R2 System.
Untested, but I have had pageencoding problems in the past. Try <cfprocessingDirective pageencoding="utf-8"> Make sure you put it every template in the operation. Putting it in application.cfm or application.cfc may not be sufficient.
Set the charset = "utf-8" when writing to the file

How to programmatically Paste CSV text into Excel and not just go into one cell? (C++)

I have a list/grid in an MFC (c++) application. I would like the user to be able to copy and paste the data into a spreadsheet.
I've placed the data in the clipboard and the text makes it to the clipboard ok and I can paste it to notepad or Word or Excel, but Excel does not interpret the comma separated value-ness of my clipboard content - so it just goes into one cell/one column - rather than doing what I had hoped.
I hope there is something simple I am missing.
Any suggestions to get this to work?
I am not quite ready to make this a drag/drop source (which is in the task list)
EDIT:
I have it working - commas can't be used - must be tab separators
But now there is a new problem:
The issue now is that if I paste to excel using '\n' as line separator it looks good in excel but not in notepad.
If I make it "\r\n" then notepad looks correct but excel then has blank lines.
Any suggestions on how to make both consistent?
I used this question and tabs seem to work - but csv still does not
How to paste CSV data to Windows Clipboard with C#
Well, here's my two cents..
It seems a tab character in an NSString, such as #"123\t456" would tell Numbers and OpenOffice spreadsheets, that 456 goes into the next cell of the same row.
Likewise, a newline character \n, or a carriage return \r, would put follow-up data on a new row, for example #"123\n456" or #"123\r456" would put 456 in the next row (starting with the first column from the left).
Indeed, TextEdit does not interpret the newline (\n) or carriage return (\r). (OpenOffice text documents do.)
However, providing the pasteboard with an array of strings (be it NSStringPBoardType, or NSRTFPBoardType, or whatever), puts the different strings on seperate rows, both in a spreadsheet and in TextEdit.
Also, a tab (\t) shows up as a tab in TextEdit, which you can then manipulate in the toolbar, to get a nice layout of your data.