E eu tenho um programa o aurora, windows optimizer que simplismente otimiza o seu windows e imprime os comandos de terminal na tela... só que tem um problema...
Ele vem com formatação ANCI e mesmo passando isso paraUTF-8/Unicode legível ele continua interpretando os acentos como caracteres não legíveis, infelizmente não sei como resolver! já tentei de várias formas com python e nada! Se você for usar o terminal windows, claramente que ele vai apresentar em uma linguágem fácil e legível de entender, mas com linguagens ao imprimir uma saída do terminal em python em uma interface gráfica por exemplo, (WX). ele continua com essa formatação bizarra!
Resultado do comando em uma output.
def show_output_dialog(self, output):
try:
output_dialog = OutputDialog(self, -1, "Command Result", output)
output_dialog.ShowModal()
except Exception as e:
logging.error("Error showing output dialog: %s", e)
A class output
class OutputDialog(wx.Dialog):
def init(self, parent, id, title, output):
super(OutputDialog, self).init(parent, id, title, size=(400, 300))
panel = wx.Panel(self)
if output:
output_text = wx.TextCtrl(panel, -1, value=output.strip(), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.VSCROLL)
else:
output_text = wx.TextCtrl(panel, -1, value='The command was executed successfully!', style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.VSCROLL)
close_button = wx.Button(panel, label="Close")
close_button.Bind(wx.EVT_BUTTON, self.on_close)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(output_text, 1, wx.EXPAND | wx.ALL, 10)
sizer.Add(close_button, 0, wx.CENTER | wx.ALL, 10)
panel.SetSizer(sizer)
def on_close(self, event):
self.EndModal(wx.ID_OK)