我已经阅读了本网站或 Stackoverflow 上关于此主题的几乎所有答案,但未能解决以下问题。
当我从 PDF 文件复制文本并将其粘贴到文本文件file.txt
中时,文本看起来很正常,但是当我使用 cat 命令时:
cat -v file.txt
输出是:
vbox = None
M-BM- M-BM- M-BM- M-BM- def __init__(self, title="Error!", parent=None,
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- flags=Gtk.DialogFlags.MODAL, buttons=("NO",
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- Gtk.ResponseType.NO, "_YES",
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- Gtk.ResponseType.YES)):
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- super().__init__(title=title, parent=parent, flags=flags,
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- buttons=buttons)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- self.vbox = self.get_content_area()
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
spacing=5)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- icon_theme = Gtk.IconTheme.get_default()
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- icon = icon_theme.load_icon("dialog-question", 48,
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- Gtk.IconLookupFlags.FORCE_SVG)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- image = Gtk.Image.new_from_pixbuf(icon)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- self.hbox.pack_start(image, False, False, 5)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- self.vbox.add(self.hbox)
M-BM- M-BM- M-BM- M-BM- def set_message(self, message, add_msg=None):
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- self.hbox.pack_start(Gtk.Label(message), False, False, 5)
M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- M-BM- if add_msg != None:
或者当我使用bat 命令时:
bat -A file.txt
输出是:
vbox•=•None␊
\u{a0}\u{a0}\u{a0}\u{a0}def•__init__(self,•title="Error!",•parent=None,␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}flags=Gtk.DialogFlags.MODAL,•buttons=("NO",␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}Gtk.ResponseType.NO,•"_YES",␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}Gtk.ResponseType.YES)):␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}super().__init__(title=title,•parent=parent,•flags=flags,␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}buttons=buttons)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}self.vbox•=•self.get_content_area()␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}self.hbox•=•Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,␊
spacing=5)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}icon_theme•=•Gtk.IconTheme.get_default()␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}icon•=•icon_theme.load_icon("dialog-question",•48,␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}Gtk.IconLookupFlags.FORCE_SVG)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}image•=•Gtk.Image.new_from_pixbuf(icon)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}self.hbox.pack_start(image,•False,•False,•5)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}self.vbox.add(self.hbox)␊
\u{a0}\u{a0}\u{a0}\u{a0}def•set_message(self,•message,•add_msg=None):␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}self.hbox.pack_start(Gtk.Label(message),•False,•False,•5)␊
\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}\u{a0}if•add_msg•!=•None:␊
在 Visual Studio 代码上,当我将鼠标悬停在这些字符上时,我得到:
The character U+00a0 is not a basic ASCII character.
如何使用 sed 命令将这些字符替换为普通的“空格”字符?