Monodevelop: embedded resource line-ending CRLF converted to LF?

…衆ロ難τιáo~ 提交于 2019-12-24 19:03:17

问题


I have a resource which isn't exactly textual. It's a file with some texts in it and some ansi control code. In my program I'm processing it as a binary file. However, I found that when I load it with System.Resources.ResourceManager.GetObject() as a byte[], all CRLFs are converted to LFs. This is not exactly what I want. I wonder if it's happening at compile time or runtime.

The same project works fine on Xamarin on Windows and OS X. No conversion is happening. It's only happening on Linux. And I'm sure the file on the disk does contain CRLFs. I checked the file size against the size of the byte[] loaded by ResourceManager.

Any ideas how to prevent this from happening? Thanks.


回答1:


This behavior depends on setting Options->Text Editor->General->Line ending convetion:

You probably have this settings set to "Always convert line endings" and you probably want either "Leave line endings as is" or "Always ask for conversion".

This could also be connected to your GIT settings which converts all line endings to LFs during checkout. See "git config core.eol" and "git config core.autocrlf" for more informations.



来源:https://stackoverflow.com/questions/24682980/monodevelop-embedded-resource-line-ending-crlf-converted-to-lf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!