在Windows上将文本从编辑器复制到记事本是不清晰的(LF问题) [英] Copying text from Editor to Notepad is illegible(LF issue) on Windows

查看:183
本文介绍了在Windows上将文本从编辑器复制到记事本是不清晰的(LF问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MFC应用程序,提供了用于显示的编辑器,我遇到了
问题 当我键入文本并将文本从编辑器复制到记事本时,该文本难以辨认.

根据信息.行尾在Windows中为CRLF,在Unix中为LF,但是即使进行了必要的EOL更新,

E

I am using MFC Application, Editor provided for display, I have encountered the problem of
When I type text and copy text from editor to Notepad, the text is illegible.

As per Information. The End of Line is CRLF in windows and LF in Unix varaints, but, even though necessary EOL updations are made,

E

<sendmessage(sci_seteolmode,2,0);>



上面是scintilla编辑器(ScintillaWnd.cpp MFC包装程序)中提供的sendmessage,并且在MyViewClass中已进行了必要的更改以处理EOL模式,但错误仍然存​​在.

为什么要停止EOL<<<>>>会在记事本中模糊地解释,但不会在写字板或任何其他文档中解释.可以采取什么措施来避免这种情况.
请让我知道.



the above is sendmessage provided in scintilla editor(ScintillaWnd.cpp MFC wrapper), and necessary changes have been done in MyViewClass, for handling EOL mode, but still the error persists.

Why the EOL <<LF>> is interpreted in Notepad illegibly, but not in Wordpad or any other document. What can be done to circumvent the same.
Please let me know.

推荐答案

记事本使用标准的Windows编辑框.这需要为新行设置CR/LF组合.写字板使用自定义的RichEdit控件.

基本上,您必须先在字符串中的''\n''处到处插入''\r'',然后再进行发送.有很多方法可以做到这一点.也许CString::Replace("\n", "\r\n");可能是最简单的,因为您正在使用MFC.
Notepad uses a standard Windows Edit Box. This requires a CR/LF combination for a new line. Wordpad uses a customised RichEdit control.

Basically, you are going to have to insert a ''\r'' everywhere there a ''\n'' in the string before you send it across. There are a heap of ways for doing this. Perhaps CString::Replace("\n", "\r\n"); might be the easiest since you are using MFC.


这篇关于在Windows上将文本从编辑器复制到记事本是不清晰的(LF问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆