Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No CRLF support #16

Open
pixelshaded opened this issue Jun 19, 2013 · 4 comments
Open

No CRLF support #16

pixelshaded opened this issue Jun 19, 2013 · 4 comments

Comments

@pixelshaded
Copy link

When I commit on my windows machine, git replaces LF with CRLF in my tiny file. After that Tiny is no longer able to get my data out of the database,

@Tenzer
Copy link
Contributor

Tenzer commented Jun 19, 2013

You can not blame tiny for not working properly if some other program such as Git changes its data. The proper way to handle this is with a .gitattributes file, specifying the path to your tiny database should always have LF line endings. See the man page for .gitattributes: http://git-scm.com/docs/gitattributes

If you really think this is a problem which should be fixed in tiny, then I suggest you look into this loop: https://github.com/chjj/node-tiny/blob/master/lib/tiny.js#L179-L210
It should probably be possible to get it to ignore 0x0D characters (CR).

@pixelshaded
Copy link
Author

I understand your perspective. The data Tiny expects is indeed being manipulated from the outside, so I can see how this would seem like it should be of no concern to the library. The tiny file is however simply a text file. IDEs and operating systems tend to enjoy messing with the line endings of this type of file. If the parsing logic depends on platform specific line endings, then it would seem reasonable to assert that perhaps cross platform compatibility is not a concern.

@Tenzer
Copy link
Contributor

Tenzer commented Jun 19, 2013

I gave a shot at adding support for CRLF line endings, just for the fun of it. You can try it out with my branch here, and please let me know how it works for you: https://github.com/Tenzer/node-tiny/tree/crlf-support

@pixelshaded
Copy link
Author

oh jeez! Thanks for your efforts, but we had already made your suggested git fix before you posted it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants