[Issue] Carriage Return converted to Line Feed when opening CSV file

Discuss the spreadsheet application
Post Reply
Monster
Posts: 2
Joined: Thu Jun 01, 2023 11:59 am

[Issue] Carriage Return converted to Line Feed when opening CSV file

Post by Monster »

Hi.
OpenOffice Calc converts Carriage Return to Line Feed when opening a csv-file.
Is there a way to change this behaviour?
Last edited by MrProgrammer on Thu Jun 01, 2023 8:11 pm, edited 2 times in total.
OpenOffice 4.1.14 on win10
User avatar
Hagar Delest
Moderator
Posts: 32663
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: openoffice calc converts Carriage Return to Line Feed when opening a csv file

Post by Hagar Delest »

Hi and welcome to the forum!

Can you upload a sample file showing that (see How to attach a document here)?
I don't see that with LibreOffice and I'm not sure CSV makes the difference between carriage return and line feed. Thus, can't see how AOO/LO could make the difference.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Monster
Posts: 2
Joined: Thu Jun 01, 2023 11:59 am

Re: Carriage Return converted to Line Feed when opening a csv file

Post by Monster »

I have attached the original file and two screenshots:
Original file:
Screenshot-orig.jpg
Screenshot-orig.jpg (23.36 KiB) Viewed 833 times
File after opening and saving:
Screenshot-after-open-and-save.jpg
Screenshot-after-open-and-save.jpg (22.92 KiB) Viewed 833 times
Attachments
test.csv
(37 Bytes) Downloaded 44 times
OpenOffice 4.1.14 on win10
User avatar
MrProgrammer
Moderator
Posts: 4907
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Carriage Return converted to Line Feed when opening a csv file

Post by MrProgrammer »

Monster wrote: Thu Jun 01, 2023 12:03 pm OpenOffice Calc converts Carriage Return to Line Feed when opening a csv-file.
Issue 82952 - CSV import is wrong on CR (0x13) value
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Carriage Return converted to Line Feed when opening a csv file

Post by Villeroy »

Specify the text delimiter as " (double-quote) and you get the ID and three lines of text in cell B2.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
MrProgrammer
Moderator
Posts: 4907
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Carriage Return converted to Line Feed when opening a csv file

Post by MrProgrammer »

Villeroy wrote: Thu Jun 01, 2023 5:26 pm Specify the text delimiter as " (double-quote) and you get the ID and three lines of text in cell B2.
Yes, however the Carriage Return characters U+000D in the CSV file were imported as Linefeed characters U+000A in B2, as shown in the image below. This is what the OpenOffice issue describes.

Data in CSV files is often in strange configurations, depending on what conventions the creator used. In this case we have a CRLF sequence written as three(!) characters: CarriageReturn Backslash n. It's hardly surprising that Calc cannot support every weird convention that might exist. Since the Linefeed was created as \n it's odd that Carriage Return isn't \r. \r\n would import/export properly, though it wouldn't display as multi-line in a cell. If the goal is to have multi-line cell value, Calc has done the import properly since only Linefeed does that. =1&CHAR(10)&2 displays as two lines; =1&CHAR(13)&2 as one.
202306011029.png
202306011029.png (80.37 KiB) Viewed 743 times
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
Hagar Delest
Moderator
Posts: 32663
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Issue] Carriage Return converted to Line Feed when opening CSV file

Post by Hagar Delest »

At least the import follows the intent of the writer it seems. Since for the ID 1, the string was designed to be on 3 lines.
Thus in this case, it is not really a bug. It is just an operation to be done on that kind of content.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Post Reply