newline

Parsing CSV files with escaped newlines in Ruby?

How do I parse CSV files with escaped newlines in Ruby? I don't see anything obvious in CSV or FasterCSV. Here is some example input: "foo", "bar" "rah", "baz \ and stuff" "green", "red" In Python, I would do this: csvFile = "foo.csv" csv.register_dialect('blah', escapechar='\\') csvReader = csv.reader(open(csvFile), "blah") ...

XML deserialization 'standardising' line endings, how to stop it? (.NET)

I have a class with a property marked with [XmlText], that accepts multiline input. In my XML file, I've verified that the line endings inside the text content are infact "\r\n", the same as the rest of the file. The code I'm using to deserialize is: XmlSerializer configSerializer = new XmlSerializer(typeof(WorldList)); string file = "...

Problem detecting Newlines in JavaScript Range Object

I have some javascript that manipulates html based on what the user has selected. For real browsers the methods I'm using leverage the "Range" object, obtained as such: var sel = window.getSelection(); var range = sel.getRangeAt(0); var content = range.toString(); The content variable contains all the selected text, which ...

Match any character (including newlines) in sed

I have a sed command that I want to run on a huge, terrible, ugly html file that was created from a microsoft word document. All it should do is remove any instance of the string style='text-align:center; color:blue; exampleStyle:exampleValue' The sed command that I am trying to modify is sed "s/ style='[^']*'//" fileA > fileB It w...

Newline Madness in Bash Script

i have a bash script I edit on windows using UltraEdit and save as UTF-8 No BOM, using Unix Line Terminator style, as specified in the "save as" dialog box in UE. I then upload it to a centos 5 x86 machine running parallels virtuozzo, and everytime, no matter how i upload it (FTP as binary file, or via parallels management console), the...

Newline in textarea in DetailsView (asp.net)

I just updated a page to use a DetailsView in asp.net. It included a MultiLine textbox, which is now in the EditItemTemplate of the details view. The problem is that when outputting this data (which is stored in the database), I was replacing vbCrLf (a new line contant --> VB, Carriage Return, Line Feed) with <br/>, which worked fine b...

vba userforms carriage return behavior

In a textbox of a userform in VBA, I would like to enable the feature where the user can add a new line in the textbox by pressing the "Enter" key on the keyboard. However, I had trouble finding a UI option in the UI editor to achieve this. Is this even allowed in VBA userforms? Thanks in advance for the advices and answers. ...

Zend Framework: File Getter Action returns a spurious newline

I'm trying to make an action that returns a file from disk to the user (via little download dialog popup box.) I've got it working great, except somehow a newline is being inserted as the first character. This breaks jpeg and doc files, for example. If I remove the newline from the downloaded file, the files work. I've also looked throu...

Can you force Vim to show a blank line at the end of a file?

When I open a text file in Notepad, it shows a blank line if there is a carriage return at the end of the last line containing text. However, in Vim it does not show this blank line. Another thing I've noticed is that the Vim editor adds a carriage return to the last line by default (even though it doesn't show it). I can tell, because i...

How to preserve newlines in CDATA when generating XML?

Hello, I want to write some text that contains whitespace characters such as newline and tab into an xml file so I use Element element = xmldoc.createElement("TestElement"); element.appendChild(xmldoc.createCDATASection(somestring)); but when I read this back in using Node vs = xmldoc.getElementsByTagName("TestElement").item(0); Str...

How to know new line character in fscanf?

Hi gurus, How to know that fscanf reached a new line \n in a file. I have been using my own functions for doing that. I know I can use fgets and then sscanf for my required pattern. But my requirements are not stable, some times I want to get TAB separated strings, some times new line separated strings and some times some special charac...

read() from stdin doesn't ignore newline

I am using the following conditional statement to read from standard input. if ((n = read(0,buf,sizeof(buf))) != 0) When inputting data from standard input, generally the user presses enter when done. But read() considers '\n' as input too in which case n = 1 and the conditional doesn't evaluate to false. Is there a way to make the co...

Generating CSV file for Excel, how to have a newline inside a value

I need to generate a file for Excel, some of the values in this file contain multiple lines. there's also non-English text in there, so the file has to be Unicode. The file I'm generating now looks like this: (in UTF8, with non English text mixed in and with a lot of lines) Header1,Header2,Header3 Value1,Value2,"Value3 Line1 Value3 Li...

Search for New Line position in VB.NET String Variable using INSTR

I have an application in VB.NET which gets "String" data from the database. This String has data which looks as below: "This is the update: I have an issue with the application" I need only part of the data, that comes after the new line i.e. "I have an issue with the application". For this I am trying to search the position usi...

How can I alternate between mysqli_real_escape_string and \nl?

Hi all, I've been doing some reading on mysqli_real_escape_string(), and, after getting my content properly escaped, I'm having some trouble getting to display properly when I pull it out again. Here's the code I have: function update_section_content() { $name = mysqli_real_escape_string($this->conn, $_POST['name']); $text = m...

SED: How can I replace a newline (\n)?

I unsuccesfully tried: sed 's#/\n# #g' file sed 's#^$# #g' file How to fix it? ...

passing \n into javascript

hi, I have a javascript function that takes in a parameter that is given by a php session. This works well except when the value is from a text area that contains a newline character. I guess it appears as if I'm passing in a parameter and then the newline indicates I have stopped or something like that. Please advise on how to fix this...

How do I create a new line using javascript that shows correctly in notepad?

I have a script that copies table cells from the browser into the user's clipboard. I loop through each cell and when a new line is needed I use text += "\n"; If I paste the text into excel, it formats correctly and fills in the proper rows, however if I paste into notepad, it shows a symbol instead of creating a new line: 123□456□78...

NL char when useing imagestring in php

I was wondering if anyone knows how I could remove or replace these annoying N over L (I'm guessing means newline) from my php string before printing them to an image. the text looks like this any help much appreciated as I have wasted hours on this little problem... <?php exec('/usr/games/fortune -s', $fortune); for($i = 0; $i <= cou...

How do I add a newline to a windows-forms TextBox?

I am trying to add a line of text to a TextBox component in VB.net, but I cannot figure out for the life of me how to force a new line. Right now it just adds onto what I have already, and that is not good. I have tried copying the actual linebreaks, didn't work. I tried AppendText(), didn't work. How on earth do I do this? It is multi...