问题描述
我一直在学习Markdown,并使用Python Markdown包,当我尝试转换从网络粘贴的文本时,该包通常返回以下内容:
I've been learning Markdown, and using the Python Markdown package, which often returns the following when I try to convert text that has been pasted in from the web:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
position 1611: ordinal not in range(128)
在编辑器的底部,我目前看到以下内容:
At the bottom of my editor I currently see this:
COMMAND MODE, Line X, Column Y
Sublime Text 2中是否有设置始终显示完整位置(如上例中的1611
所示),以便我可以快速找到不良字符?
Is there a setting in Sublime Text 2 that will show the full position (as in 1611
in the example above) at all times so I can quickly find the bad character?
推荐答案
您可以制作一个简单的python脚本来执行此操作.
You could make a simple python script to do this.
1.将此代码另存为characterCounter.py
(Preferences > Browse Packages > User
):
1.Save this code to your User folder as characterCounter.py
(Preferences > Browse Packages > User
):
import sublime, sublime_plugin
class PositionListener(sublime_plugin.EventListener):
def on_selection_modified(self,view):
text = "Position: "
sels = view.sel()
for s in sels:
text += " " + str(s.begin())
if not s.empty():
text += "-" + str(s.end()) + " "
view.set_status('exact_pos', text)
2.然后重新启动Sublime Text以将其加载.
2.Then restart Sublime Text to have it loaded.
这篇关于是否可以在Sublime Text 2中显示确切位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!