problems opening particular rmd file/rstudio not responsive - r-markdown

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.

Related

How to strip invisible 'hex c' character from us-ascii document that I cannot process in xslt

I'm reading in a us-ascii document and trying to parse into XML
<xsl:analyze-string select="unparsed-text($filename,'us-ascii')" regex="{$regex_clp}">
However I'm getting the error
XTDE1190: The unparsed-text file contains a character that is illegal in XML (line=51 column=2 value=hex c)
In seeking to identify this character, I did a find and replace on all the visible character
and new lines and I'm left with a blank character in the document that causes the same error in a different position when executing the xslt script.
XTDE1190: The unparsed-text file contains a character that is illegal in XML (line=1 column=2 value=hex c)
When I copy and paste this 'hex c' into a java application attempting to strip it and then try to delete it with the backspace button it does not delete and rather I can push the backspace button multiple times and the cursor remains in the same position next to 'hex c' that I pasted.
I've uploaded this file here that has the 'hex c' character
https://drive.google.com/file/d/1e0hkfraiSz39QEPV_zWn0ujyYcQknSCD/view?usp=sharing
Any idea what this character is and how to strip this character out of the file?
Regards
Conteh
Okay so after I posted the text file to google in creating this question, I download the out.txt just to make it still had the same problem after uploading and download from google.
However this time I could see a bunch of symbols in the text file. I copied them and into OxygenXML find and replace to see these were \f form feed
I found and replaced with \f and the problem was solved.
\f identifies (form feed, 0x0C).
Regards
Conteh

How to find and replace box character in text file?

I have a large text file that I'm going to be working with programmatically but have run into problems with a special character strewn throughout the file. The file is way too large to scan it looking for specific characters. Most of the other unwanted special characters I've been able to get rid of using some regex pattern. But there is a box character, similar to "□". When I tried to copy the character from the actual text file and past it here I get "�", so the example of the box is from Windows character map which includes the code 'U+25A1', which I'm not sure how to interpret or if it's something I could use for a regex search.
Would anyone know how I could search for the box symbol similar to "□" in a UTF-8 encoded file?
EDIT:
Here is an example from the text file:
"� Prune palms when flower spathes show, or delay pruning until after the palm has finished flowering, to prevent infestation of palm flower caterpillars. Leave the top five rows."
The only problem is that, as mentioned in the original post, the square gets converted into a diamond question mark.
It's unclear where and how you are searching, although you could use the hex equivalent:
\x{25A1}
Example:
https://regex101.com/r/b84oBs/1
The black diamond with a question mark is not a character, per se. It is what a browser spits out at you when you give it unrecognizable bytes.
Find out where that data is coming from.
Determine its encoding. (Usually UTF-8, but might be something else.)
Be sure the browser is configured to display that encoding. This is likely to suffice <meta charset=UTF-8> in the header of the page.
I found a workaround using Notepad++ and this website. It's still not clear what encoding system the square is originally from, but when I post it into the query field in the website above or into the Notepad++ Conversion Table (Plugins > Converter > Conversion Table) it gives the hex-character code for the "Replacement Character" which is the diamond with the question mark.
Using this code in a regex expression, \x{FFFD}, within Notepad++ search gave me all the squares, although recognizing them as the Replacement Character.

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.

Does the Wrap function in ColdFusion insert CR/LFs?

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)#" />

Can I use a "\n" character in strings that are to be translated with Qt Linguist

I'm working on supporting different languages for our GUI. I'm having a problem translating strings that have a '\n' in them. They seem to be ignored.
In Qt Designer I have a QCheckBox with this in the text field:
Here's an \nexample that doesn't work
This appears in english in our french translation.
Having looked at the .ts XML it seems that the text after the '\n' is ommited (I guess this is why it doesn't get translated ?)
Does anyone have a way of including a newline in the original text?
Seems I had carriage returns in my text before the newline. (no idea how they got there)
e.g
Here's an [][][][]\nexample that doesn't work
After removing them, the translation worked.
The "\n" character itself was not my problem.
Some invisible carriage returns in the string was the culprit.
See http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=81275
Use the HTML subset: "Here's an <br />example that does work".