Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » EOL problem
EOL problem [message #21818] Sat, 06 June 2009 21:12 Go to next message
gridem is currently offline  gridem
Messages: 45
Registered: August 2008
Member
Using XML serialization I found the problem with EOL symbols: XML file was generated using '\n' on Windows platform. This is not a problem in many situations. But this file is opened in Windows notepad incorrectly.

So to correct this behavior on various platforms I prepared the patch which fixes my and other problems with EOL. I think it will be useful to include such patch into the main repository.

Patch was created on 1270 revision.
Re: EOL problem [message #21826 is a reply to message #21818] Sun, 07 June 2009 21:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
gridem wrote on Sat, 06 June 2009 15:12

Using XML serialization I found the problem with EOL symbols: XML file was generated using '\n' on Windows platform. This is not a problem in many situations. But this file is opened in Windows notepad incorrectly.

So to correct this behavior on various platforms I prepared the patch which fixes my and other problems with EOL. I think it will be useful to include such patch into the main repository.

Patch was created on 1270 revision.


I am not sure this is the right approach. I believe that this will make Win32 code emit "\r\n" while Linux code will emit "\n".

Anyway, that is not too good for interchangeable format, is not it?

Maybe the better approach would be to generate "\r\n" always?

(So much trouble for single stupid notepad.exe... )

Mirek
Re: EOL problem [message #21827 is a reply to message #21826] Sun, 07 June 2009 21:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
http://www.velocityreviews.com/forums/t167618-lf-cr-handling .html

Mirek
Re: EOL problem [message #21880 is a reply to message #21827] Tue, 09 June 2009 09:51 Go to previous message
gridem is currently offline  gridem
Messages: 45
Registered: August 2008
Member
XML specification says:

-------
2.11 End-of-Line Handling

XML parsed entities are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).

To simplify the tasks of applications, the XML processor MUST behave as if it normalized all line breaks in external parsed entities (including the document entity) on input, before parsing, by translating both the two-character sequence #xD #xA and any #xD that is not followed by #xA to a single #xA character.
-------

So this paragraph denotes how the line will be interpreted during parsing the XML file. As I understand:
CR LF -> LF
LF CR -> LF
CR -> LF
LF -> LF

But this line doesn't tell us what we should do in case of saving the file in XML format. Also the problem appears not from parsing the entity but from saving the spaces between tags itself.

I think that the saving using Windows EOL format will be good solution, because this approach had been used in QTF project.

Sorry for my bad English.
Previous Topic: Problem with DirectoryExists() in windows
Next Topic: string filtering bug
Goto Forum:
  


Current Time: Mon Apr 29 17:12:25 CEST 2024

Total time taken to generate the page: 0.02815 seconds