Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

python - delete U+200B zero-width space characters using sublime text 3

How can I make U+200B character or delete them in using sublime text 3. I found http://pastebin.com/ehWxNfMe but I am not sure how to use it

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The easiest way to delete zero width spaces in Sublime Text is using the search and replace functionality:

  • Press Ctrl + h ( Alt + Cmd + f for Mac )
  • Enable the Regular expression flag by clicking the leftmost button on the search panel or pressing Alt + r ( Alt + Cmd + r for Mac )
  • Enter x{200b} as the search term
  • Make sure the "Replace with" field is empty and hit "Replace All"

Plugins for solving this problem for good!

I searched for a plugin that would highlight all the possibly code breaking characters but couldn't find one for Sublime Text so I wrote one: https://github.com/TuureKaunisto/highlight-dodgy-chars

The plugin works on a whitelist principle: all non-ascii characters that are not whitelisted in the settings get highlighted.

If you want to highlight things based on your own regular expression, this plugin will do the trick: https://github.com/bluegray/Highlighter and is also easily installable via Package Manager.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...